@availity/api-core
Advanced tools
Comparing version 7.0.0-alpha.2 to 7.0.0-alpha.9
586
CHANGELOG.md
@@ -6,8 +6,8 @@ # Change Log | ||
## [6.0.3](https://github.com/Availity/sdk-js/compare/@availity/api-core@6.0.2...@availity/api-core@6.0.3) (2019-12-03) | ||
# [6.3.0](https://github.com/Availity/sdk-js/compare/@availity/api-core@6.2.6...@availity/api-core@6.3.0) (2020-05-11) | ||
### Performance Improvements | ||
### Features | ||
* **api-core:** use userId if it exists in get,set application settings ([6cdd059](https://github.com/Availity/sdk-js/commit/6cdd059)) | ||
* **api-core:** add support for filtering organizations by permission and resource ([b607943](https://github.com/Availity/sdk-js/commit/b607943c9908d7d684013ec18678a1c05b9f1baf)) | ||
@@ -18,42 +18,44 @@ | ||
## [6.0.2](https://github.com/Availity/sdk-js/compare/@availity/api-core@6.0.1...@availity/api-core@6.0.2) (2019-12-02) | ||
## 6.2.6 (2020-05-01) | ||
**Note:** Version bump only for package @availity/api-core | ||
### Performance Improvements | ||
* **api-core:** use userId from params if it exists in getOrganizations ([5e5225f](https://github.com/Availity/sdk-js/commit/5e5225f)) | ||
## 6.2.5 (2020-04-30) | ||
**Note:** Version bump only for package @availity/api-core | ||
## [6.0.1](https://github.com/Availity/sdk-js/compare/@availity/api-core@6.0.0...@availity/api-core@6.0.1) (2019-11-05) | ||
### Bug Fixes | ||
* **api-core:** do not use config url when resolving location header ([199536f](https://github.com/Availity/sdk-js/commit/199536f)) | ||
## 6.2.4 (2020-04-22) | ||
**Note:** Version bump only for package @availity/api-core | ||
# [6.0.0](https://github.com/Availity/sdk-js/compare/@availity/api-core@5.4.1...@availity/api-core@6.0.0) (2019-10-21) | ||
### Code Refactoring | ||
## 6.2.3 (2020-04-08) | ||
* **localstorage-core:** converted class to function ([9f1fdf0](https://github.com/Availity/sdk-js/commit/9f1fdf0)) | ||
**Note:** Version bump only for package @availity/api-core | ||
### BREAKING CHANGES | ||
* **localstorage-core:** Class is now a Function and doesn't require to be instantiated. | ||
## 6.2.2 (2020-04-06) | ||
**Note:** Version bump only for package @availity/api-core | ||
## [5.4.1](https://github.com/Availity/sdk-js/compare/@availity/api-core@5.4.0...@availity/api-core@5.4.1) (2019-09-27) | ||
## 6.2.1 (2020-04-06) | ||
**Note:** Version bump only for package @availity/api-core | ||
@@ -65,3 +67,3 @@ | ||
# [5.4.0](https://github.com/Availity/sdk-js/compare/@availity/api-core@5.2.1...@availity/api-core@5.4.0) (2019-08-01) | ||
# [6.2.0](https://github.com/Availity/sdk-js/compare/@availity/api-core@6.1.16...@availity/api-core@6.2.0) (2020-03-25) | ||
@@ -71,3 +73,4 @@ | ||
* **api-core:** add webQL resource ([67b9797](https://github.com/Availity/sdk-js/commit/67b9797)) | ||
* **api-core:** added tests for new patch method, see issue [#225](https://github.com/Availity/sdk-js/issues/225) ([5498a78](https://github.com/Availity/sdk-js/commit/5498a78f3e63567e40eb1b6bb1e035c3f70c124b)) | ||
* **api-core:** proposed support for patch method, see issue [#225](https://github.com/Availity/sdk-js/issues/225) ([2ff4085](https://github.com/Availity/sdk-js/commit/2ff40857dd9d36b383278f4c4743e45de511ddee)) | ||
@@ -78,41 +81,40 @@ | ||
# [5.3.0](https://github.com/Availity/sdk-js/compare/@availity/api-core@5.2.1...@availity/api-core@5.3.0) (2019-08-01) | ||
## [6.1.16](https://github.com/Availity/sdk-js/compare/@availity/api-core@6.1.15...@availity/api-core@6.1.16) (2020-03-06) | ||
**Note:** Version bump only for package @availity/api-core | ||
### Features | ||
* **api-core:** add webQL resource ([67b9797](https://github.com/Availity/sdk-js/commit/67b9797)) | ||
## [6.1.15](https://github.com/Availity/sdk-js/compare/@availity/api-core@6.1.14...@availity/api-core@6.1.15) (2020-03-04) | ||
**Note:** Version bump only for package @availity/api-core | ||
## [5.2.1](https://github.com/Availity/sdk-js/compare/@availity/api-core@5.2.0...@availity/api-core@5.2.1) (2019-06-21) | ||
### Bug Fixes | ||
* **api-core:** fix namespace of slotmachine resource ([3c3af84](https://github.com/Availity/sdk-js/commit/3c3af84)) | ||
## [6.1.14](https://github.com/Availity/sdk-js/compare/@availity/api-core@6.1.13...@availity/api-core@6.1.14) (2020-03-02) | ||
**Note:** Version bump only for package @availity/api-core | ||
# [5.2.0](https://github.com/Availity/sdk-js/compare/@availity/api-core@5.1.6...@availity/api-core@5.2.0) (2019-06-14) | ||
### Features | ||
## [6.1.13](https://github.com/Availity/sdk-js/compare/@availity/api-core@6.1.12...@availity/api-core@6.1.13) (2020-02-18) | ||
* **api-core:** add codes resource ([4ea7ba4](https://github.com/Availity/sdk-js/commit/4ea7ba4)) | ||
### Performance Improvements | ||
* **api-core:** use userId if it exists in call to getRegions ([e94de9e](https://github.com/Availity/sdk-js/commit/e94de9eb3f4d04247ba6bc1f76ce3deb4341e609)) | ||
## [5.1.6](https://github.com/Availity/sdk-js/compare/@availity/api-core@5.1.5...@availity/api-core@5.1.6) (2019-05-31) | ||
### Bug Fixes | ||
## [6.1.12](https://github.com/Availity/sdk-js/compare/@availity/api-core@6.1.9...@availity/api-core@6.1.12) (2020-02-13) | ||
* **api-core:** graceful exit when polling ([9708eff](https://github.com/Availity/sdk-js/commit/9708eff)) | ||
**Note:** Version bump only for package @availity/api-core | ||
@@ -123,3 +125,3 @@ | ||
## [5.1.5](https://github.com/Availity/sdk-js/compare/@availity/api-core@5.1.4...@availity/api-core@5.1.5) (2019-04-29) | ||
## [6.1.11](https://github.com/Availity/sdk-js/compare/@availity/api-core@6.1.10...@availity/api-core@6.1.11) (2020-02-13) | ||
@@ -132,3 +134,3 @@ **Note:** Version bump only for package @availity/api-core | ||
## [5.1.4](https://github.com/Availity/sdk-js/compare/@availity/api-core@5.1.3...@availity/api-core@5.1.4) (2019-04-26) | ||
## [6.1.10](https://github.com/Availity/sdk-js/compare/@availity/api-core@6.1.8...@availity/api-core@6.1.10) (2020-02-13) | ||
@@ -141,3 +143,3 @@ **Note:** Version bump only for package @availity/api-core | ||
## [5.1.3](https://github.com/Availity/sdk-js/compare/@availity/api-core@5.1.2...@availity/api-core@5.1.3) (2019-04-25) | ||
## [6.1.9](https://github.com/Availity/sdk-js/compare/@availity/api-core@6.1.7...@availity/api-core@6.1.9) (2020-02-13) | ||
@@ -150,3 +152,3 @@ **Note:** Version bump only for package @availity/api-core | ||
## [5.1.2](https://github.com/Availity/sdk-js/compare/@availity/api-core@5.1.1...@availity/api-core@5.1.2) (2019-04-25) | ||
## [6.1.8](https://github.com/Availity/sdk-js/compare/@availity/api-core@6.1.7...@availity/api-core@6.1.8) (2020-02-13) | ||
@@ -159,51 +161,45 @@ **Note:** Version bump only for package @availity/api-core | ||
## [5.1.1](https://github.com/Availity/sdk-js/compare/@availity/api-core@5.1.0...@availity/api-core@5.1.1) (2019-04-23) | ||
## [6.1.7](https://github.com/Availity/sdk-js/compare/@availity/api-core@6.1.4...@availity/api-core@6.1.7) (2020-02-13) | ||
**Note:** Version bump only for package @availity/api-core | ||
### Bug Fixes | ||
* **api-core:** relative location header ([2ac4c5f](https://github.com/Availity/sdk-js/commit/2ac4c5f)), closes [#77](https://github.com/Availity/sdk-js/issues/77) | ||
* **api-core:** resolve relative url from request url ([8e6abbb](https://github.com/Availity/sdk-js/commit/8e6abbb)), closes [#77](https://github.com/Availity/sdk-js/issues/77) | ||
## [6.1.6](https://github.com/Availity/sdk-js/compare/@availity/api-core@6.1.5...@availity/api-core@6.1.6) (2020-02-13) | ||
**Note:** Version bump only for package @availity/api-core | ||
# [5.1.0](https://github.com/Availity/sdk-js/compare/@availity/api-core@5.0.1...@availity/api-core@5.1.0) (2019-04-17) | ||
### Features | ||
* **analytics-core:** added dma logging service ([68aee41](https://github.com/Availity/sdk-js/commit/68aee41)) | ||
## [6.1.5](https://github.com/Availity/sdk-js/compare/@availity/api-core@6.1.4...@availity/api-core@6.1.5) (2020-02-13) | ||
**Note:** Version bump only for package @availity/api-core | ||
## [5.0.1](https://github.com/Availity/sdk-js/compare/@availity/api-core@5.0.0...@availity/api-core@5.0.1) (2019-04-17) | ||
**Note:** Version bump only for package @availity/api-core | ||
## [6.1.4](https://github.com/Availity/sdk-js/compare/@availity/api-core@6.1.3...@availity/api-core@6.1.4) (2020-02-12) | ||
**Note:** Version bump only for package @availity/api-core | ||
# [5.0.0](https://github.com/Availity/sdk-js/compare/@availity/api-core@4.0.1...@availity/api-core@5.0.0) (2019-03-18) | ||
### Bug Fixes | ||
## [6.1.3](https://github.com/Availity/sdk-js/compare/@availity/api-core@6.1.2...@availity/api-core@6.1.3) (2020-01-28) | ||
* **dl-core:** fixed dev dep ([15d572a](https://github.com/Availity/sdk-js/commit/15d572a)) | ||
* add lerna ignore for package-locks ([3217d96](https://github.com/Availity/sdk-js/commit/3217d96)) | ||
* fixed package-lock issues boiling down to this repo ([8c896f4](https://github.com/Availity/sdk-js/commit/8c896f4)) | ||
**Note:** Version bump only for package @availity/api-core | ||
### Features | ||
* **api-core:** add ability to send in variables in AvSlotMachine.query ([f83e00b](https://github.com/Availity/sdk-js/commit/f83e00b)) | ||
### BREAKING CHANGES | ||
## [6.1.2](https://github.com/Availity/sdk-js/compare/@availity/api-core@6.1.1...@availity/api-core@6.1.2) (2020-01-23) | ||
* upgrades other packages that are using old package-locks | ||
**Note:** Version bump only for package @availity/api-core | ||
@@ -214,325 +210,350 @@ | ||
# [4.1.0](https://github.com/Availity/sdk-js/compare/@availity/api-core@4.0.1...@availity/api-core@4.1.0) (2019-03-04) | ||
## [6.1.1](https://github.com/Availity/sdk-js/compare/@availity/api-core@6.1.0...@availity/api-core@6.1.1) (2020-01-14) | ||
### Bug Fixes | ||
* **dl-core:** fixed dev dep ([15d572a](https://github.com/Availity/sdk-js/commit/15d572a)) | ||
* add lerna ignore for package-locks ([3217d96](https://github.com/Availity/sdk-js/commit/3217d96)) | ||
* fixed package-lock issues boiling down to this repo ([8c896f4](https://github.com/Availity/sdk-js/commit/8c896f4)) | ||
- **api-core:** fixed error trying to call toString on undefined ([0792f85](https://github.com/Availity/sdk-js/commit/0792f85)) | ||
- **api-core:** updated handling of falsey values ([b810189](https://github.com/Availity/sdk-js/commit/b810189)) | ||
- **api-core:** updated test suite name ([b0a75c6](https://github.com/Availity/sdk-js/commit/b0a75c6)) | ||
# [6.1.0](https://github.com/Availity/sdk-js/compare/@availity/api-core@6.0.5...@availity/api-core@6.1.0) (2020-01-06) | ||
### Features | ||
* **api-core:** add ability to send in variables in AvSlotMachine.query ([f83e00b](https://github.com/Availity/sdk-js/commit/f83e00b)) | ||
- **api-core:** add beacon support to log messages ([9350765](https://github.com/Availity/sdk-js/commit/9350765)) | ||
## [6.0.5](https://github.com/Availity/sdk-js/compare/@availity/api-core@6.0.4...@availity/api-core@6.0.5) (2020-01-03) | ||
### BREAKING CHANGES | ||
**Note:** Version bump only for package @availity/api-core | ||
* upgrades other packages that are using old package-locks | ||
## [6.0.4](https://github.com/Availity/sdk-js/compare/@availity/api-core@6.0.3...@availity/api-core@6.0.4) (2020-01-03) | ||
**Note:** Version bump only for package @availity/api-core | ||
## [6.0.3](https://github.com/Availity/sdk-js/compare/@availity/api-core@6.0.2...@availity/api-core@6.0.3) (2019-12-03) | ||
### Performance Improvements | ||
- **api-core:** use userId if it exists in get,set application settings ([6cdd059](https://github.com/Availity/sdk-js/commit/6cdd059)) | ||
## [4.0.1](https://github.com/Availity/sdk-js/compare/@availity/api-core@4.0.0...@availity/api-core@4.0.1) (2019-02-12) | ||
## [6.0.2](https://github.com/Availity/sdk-js/compare/@availity/api-core@6.0.1...@availity/api-core@6.0.2) (2019-12-02) | ||
**Note:** Version bump only for package @availity/api-core | ||
### Performance Improvements | ||
- **api-core:** use userId from params if it exists in getOrganizations ([5e5225f](https://github.com/Availity/sdk-js/commit/5e5225f)) | ||
## [6.0.1](https://github.com/Availity/sdk-js/compare/@availity/api-core@6.0.0...@availity/api-core@6.0.1) (2019-11-05) | ||
### Bug Fixes | ||
- **api-core:** do not use config url when resolving location header ([199536f](https://github.com/Availity/sdk-js/commit/199536f)) | ||
# 4.0.0 (2019-02-12) | ||
# [6.0.0](https://github.com/Availity/sdk-js/compare/@availity/api-core@5.4.1...@availity/api-core@6.0.0) (2019-10-21) | ||
### Code Refactoring | ||
### Bug Fixes | ||
- **localstorage-core:** converted class to function ([9f1fdf0](https://github.com/Availity/sdk-js/commit/9f1fdf0)) | ||
* **api-core:** Allow array for permissions ([#67](https://github.com/Availity/sdk-js/issues/67)) ([98adf76](https://github.com/Availity/sdk-js/commit/98adf76)) | ||
* **api-core:** http should throw errors ([#83](https://github.com/Availity/sdk-js/issues/83)) ([868aa8f](https://github.com/Availity/sdk-js/commit/868aa8f)) | ||
* **api-core:** rename error object ([460fc9d](https://github.com/Availity/sdk-js/commit/460fc9d)) | ||
* **api-core:** return error from async/await ([06c35fe](https://github.com/Availity/sdk-js/commit/06c35fe)) | ||
* **api-core:** reverted changelog/canary changes ([0f775ea](https://github.com/Availity/sdk-js/commit/0f775ea)) | ||
* **api-core:** typo fix ([f543296](https://github.com/Availity/sdk-js/commit/f543296)) | ||
### BREAKING CHANGES | ||
- **localstorage-core:** Class is now a Function and doesn't require to be instantiated. | ||
### Features | ||
## [5.4.1](https://github.com/Availity/sdk-js/compare/@availity/api-core@5.4.0...@availity/api-core@5.4.1) (2019-09-27) | ||
* **api-core:** add example response for file delivery ([edc4df5](https://github.com/Availity/sdk-js/commit/edc4df5)) | ||
* **api-core:** add file upload delivery batch api ([eff0a3c](https://github.com/Availity/sdk-js/commit/eff0a3c)) | ||
* **api-core:** added graphql resource for slotmachine ([356a686](https://github.com/Availity/sdk-js/commit/356a686)) | ||
* **api-core:** added new resource for disclaimers ([b7de72e](https://github.com/Availity/sdk-js/commit/b7de72e)) | ||
**Note:** Version bump only for package @availity/api-core | ||
# [5.4.0](https://github.com/Availity/sdk-js/compare/@availity/api-core@5.2.1...@availity/api-core@5.4.0) (2019-08-01) | ||
### BREAKING CHANGES | ||
### Features | ||
* **api-core:** The httpp error is no longer caught by api-core. Also, the error object is no longer manipulated. Developers must handle the http error by catching the error when using async/await or by leveraging the error callback in the promise chain. The callback `afterResponse` is not called when and error is thrown from http call. | ||
* **api-core:** The query to the API has been changed. To get the previous behavior, supply a custom paramSerializer. | ||
- **api-core:** add webQL resource ([67b9797](https://github.com/Availity/sdk-js/commit/67b9797)) | ||
# [5.3.0](https://github.com/Availity/sdk-js/compare/@availity/api-core@5.2.1...@availity/api-core@5.3.0) (2019-08-01) | ||
# 2.6.0 (2018-08-23) | ||
### Features | ||
* **api-core:** helper function for settings api ([4d405a7](https://github.com/Availity/sdk-js/commit/4d405a7)) | ||
* **api-core:** helper function for settings api ([#64](https://github.com/Availity/sdk-js/issues/64)) ([f247235](https://github.com/Availity/sdk-js/commit/f247235)) | ||
- **api-core:** add webQL resource ([67b9797](https://github.com/Availity/sdk-js/commit/67b9797)) | ||
## [5.2.1](https://github.com/Availity/sdk-js/compare/@availity/api-core@5.2.0...@availity/api-core@5.2.1) (2019-06-21) | ||
### Bug Fixes | ||
# 2.5.0 (2018-08-20) | ||
- **api-core:** fix namespace of slotmachine resource ([3c3af84](https://github.com/Availity/sdk-js/commit/3c3af84)) | ||
# [5.2.0](https://github.com/Availity/sdk-js/compare/@availity/api-core@5.1.6...@availity/api-core@5.2.0) (2019-06-14) | ||
### Features | ||
## 2.4.8 (2018-08-06) | ||
- **api-core:** add codes resource ([4ea7ba4](https://github.com/Availity/sdk-js/commit/4ea7ba4)) | ||
## [5.1.6](https://github.com/Availity/sdk-js/compare/@availity/api-core@5.1.5...@availity/api-core@5.1.6) (2019-05-31) | ||
### Bug Fixes | ||
* **api-core:** spread args for aliases ([5c7516b](https://github.com/Availity/sdk-js/commit/5c7516b)) | ||
- **api-core:** graceful exit when polling ([9708eff](https://github.com/Availity/sdk-js/commit/9708eff)) | ||
## [5.1.5](https://github.com/Availity/sdk-js/compare/@availity/api-core@5.1.4...@availity/api-core@5.1.5) (2019-04-29) | ||
**Note:** Version bump only for package @availity/api-core | ||
## 2.4.7 (2018-08-02) | ||
## [5.1.4](https://github.com/Availity/sdk-js/compare/@availity/api-core@5.1.3...@availity/api-core@5.1.4) (2019-04-26) | ||
**Note:** Version bump only for package @availity/api-core | ||
### Bug Fixes | ||
## [5.1.3](https://github.com/Availity/sdk-js/compare/@availity/api-core@5.1.2...@availity/api-core@5.1.3) (2019-04-25) | ||
* **api-core:** check for lowercase location as well ([4a4a9a0](https://github.com/Availity/sdk-js/commit/4a4a9a0)) | ||
**Note:** Version bump only for package @availity/api-core | ||
## [5.1.2](https://github.com/Availity/sdk-js/compare/@availity/api-core@5.1.1...@availity/api-core@5.1.2) (2019-04-25) | ||
**Note:** Version bump only for package @availity/api-core | ||
## 2.4.6 (2018-08-02) | ||
## [5.1.1](https://github.com/Availity/sdk-js/compare/@availity/api-core@5.1.0...@availity/api-core@5.1.1) (2019-04-23) | ||
### Bug Fixes | ||
* **analytics-core:** fix non-click events ([fce9b26](https://github.com/Availity/sdk-js/commit/fce9b26)) | ||
- **api-core:** relative location header ([2ac4c5f](https://github.com/Availity/sdk-js/commit/2ac4c5f)), closes [#77](https://github.com/Availity/sdk-js/issues/77) | ||
- **api-core:** resolve relative url from request url ([8e6abbb](https://github.com/Availity/sdk-js/commit/8e6abbb)), closes [#77](https://github.com/Availity/sdk-js/issues/77) | ||
# [5.1.0](https://github.com/Availity/sdk-js/compare/@availity/api-core@5.0.1...@availity/api-core@5.1.0) (2019-04-17) | ||
### Features | ||
# 2.4.0 (2018-07-12) | ||
- **analytics-core:** added dma logging service ([68aee41](https://github.com/Availity/sdk-js/commit/68aee41)) | ||
## [5.0.1](https://github.com/Availity/sdk-js/compare/@availity/api-core@5.0.0...@availity/api-core@5.0.1) (2019-04-17) | ||
**Note:** Version bump only for package @availity/api-core | ||
# 2.2.0 (2018-06-29) | ||
# [5.0.0](https://github.com/Availity/sdk-js/compare/@availity/api-core@4.0.1...@availity/api-core@5.0.0) (2019-03-18) | ||
### Bug Fixes | ||
* **api-core:** format postGet payload to standard ([5b885cf](https://github.com/Availity/sdk-js/commit/5b885cf)) | ||
- **dl-core:** fixed dev dep ([15d572a](https://github.com/Availity/sdk-js/commit/15d572a)) | ||
- add lerna ignore for package-locks ([3217d96](https://github.com/Availity/sdk-js/commit/3217d96)) | ||
- fixed package-lock issues boiling down to this repo ([8c896f4](https://github.com/Availity/sdk-js/commit/8c896f4)) | ||
### Features | ||
- **api-core:** add ability to send in variables in AvSlotMachine.query ([f83e00b](https://github.com/Availity/sdk-js/commit/f83e00b)) | ||
## 2.1.2 (2018-06-13) | ||
### BREAKING CHANGES | ||
- upgrades other packages that are using old package-locks | ||
# [4.1.0](https://github.com/Availity/sdk-js/compare/@availity/api-core@4.0.1...@availity/api-core@4.1.0) (2019-03-04) | ||
### Bug Fixes | ||
* **api-core:** attempts count not increasing ([2e414a3](https://github.com/Availity/sdk-js/commit/2e414a3)) | ||
- **dl-core:** fixed dev dep ([15d572a](https://github.com/Availity/sdk-js/commit/15d572a)) | ||
- add lerna ignore for package-locks ([3217d96](https://github.com/Availity/sdk-js/commit/3217d96)) | ||
- fixed package-lock issues boiling down to this repo ([8c896f4](https://github.com/Availity/sdk-js/commit/8c896f4)) | ||
### Features | ||
- **api-core:** add ability to send in variables in AvSlotMachine.query ([f83e00b](https://github.com/Availity/sdk-js/commit/f83e00b)) | ||
## 2.1.1 (2018-05-25) | ||
### BREAKING CHANGES | ||
- upgrades other packages that are using old package-locks | ||
### Bug Fixes | ||
## [4.0.1](https://github.com/Availity/sdk-js/compare/@availity/api-core@4.0.0...@availity/api-core@4.0.1) (2019-02-12) | ||
* **api-core:** fix usage of Promise ([8fb3de8](https://github.com/Availity/sdk-js/commit/8fb3de8)) | ||
**Note:** Version bump only for package @availity/api-core | ||
# 4.0.0 (2019-02-12) | ||
### Bug Fixes | ||
# 2.1.0 (2018-05-24) | ||
- **api-core:** Allow array for permissions ([#67](https://github.com/Availity/sdk-js/issues/67)) ([98adf76](https://github.com/Availity/sdk-js/commit/98adf76)) | ||
- **api-core:** http should throw errors ([#83](https://github.com/Availity/sdk-js/issues/83)) ([868aa8f](https://github.com/Availity/sdk-js/commit/868aa8f)) | ||
- **api-core:** rename error object ([460fc9d](https://github.com/Availity/sdk-js/commit/460fc9d)) | ||
- **api-core:** return error from async/await ([06c35fe](https://github.com/Availity/sdk-js/commit/06c35fe)) | ||
- **api-core:** reverted changelog/canary changes ([0f775ea](https://github.com/Availity/sdk-js/commit/0f775ea)) | ||
- **api-core:** typo fix ([f543296](https://github.com/Availity/sdk-js/commit/f543296)) | ||
### Features | ||
* **api-core:** add all method to get all the data from all of the pages ([114519d](https://github.com/Availity/sdk-js/commit/114519d)) | ||
- **api-core:** add example response for file delivery ([edc4df5](https://github.com/Availity/sdk-js/commit/edc4df5)) | ||
- **api-core:** add file upload delivery batch api ([eff0a3c](https://github.com/Availity/sdk-js/commit/eff0a3c)) | ||
- **api-core:** added graphql resource for slotmachine ([356a686](https://github.com/Availity/sdk-js/commit/356a686)) | ||
- **api-core:** added new resource for disclaimers ([b7de72e](https://github.com/Availity/sdk-js/commit/b7de72e)) | ||
### BREAKING CHANGES | ||
- **api-core:** The httpp error is no longer caught by api-core. Also, the error object is no longer manipulated. Developers must handle the http error by catching the error when using async/await or by leveraging the error callback in the promise chain. The callback `afterResponse` is not called when and error is thrown from http call. | ||
- **api-core:** The query to the API has been changed. To get the previous behavior, supply a custom paramSerializer. | ||
## 2.0.3 (2018-05-10) | ||
# 2.6.0 (2018-08-23) | ||
### Features | ||
### Bug Fixes | ||
- **api-core:** helper function for settings api ([4d405a7](https://github.com/Availity/sdk-js/commit/4d405a7)) | ||
- **api-core:** helper function for settings api ([#64](https://github.com/Availity/sdk-js/issues/64)) ([f247235](https://github.com/Availity/sdk-js/commit/f247235)) | ||
* **api-core:** allow id to be in the config ([55b55af](https://github.com/Availity/sdk-js/commit/55b55af)) | ||
# 2.5.0 (2018-08-20) | ||
## 2.4.8 (2018-08-06) | ||
### Bug Fixes | ||
## 2.0.1 (2018-05-04) | ||
- **api-core:** spread args for aliases ([5c7516b](https://github.com/Availity/sdk-js/commit/5c7516b)) | ||
## 2.4.7 (2018-08-02) | ||
### Bug Fixes | ||
* **api-core:** get id out of arguments ([3e525c2](https://github.com/Availity/sdk-js/commit/3e525c2)) | ||
- **api-core:** check for lowercase location as well ([4a4a9a0](https://github.com/Availity/sdk-js/commit/4a4a9a0)) | ||
## 2.4.6 (2018-08-02) | ||
### Bug Fixes | ||
# 2.0.0 (2018-05-04) | ||
- **analytics-core:** fix non-click events ([fce9b26](https://github.com/Availity/sdk-js/commit/fce9b26)) | ||
# 2.4.0 (2018-07-12) | ||
# 2.2.0 (2018-06-29) | ||
### Bug Fixes | ||
* **api-core:** avSpaces - throw error when no spaceId given ([7c47280](https://github.com/Availity/sdk-js/commit/7c47280)) | ||
- **api-core:** format postGet payload to standard ([5b885cf](https://github.com/Availity/sdk-js/commit/5b885cf)) | ||
## 2.1.2 (2018-06-13) | ||
### Bug Fixes | ||
# 1.4.0 (2018-04-17) | ||
- **api-core:** attempts count not increasing ([2e414a3](https://github.com/Availity/sdk-js/commit/2e414a3)) | ||
## 2.1.1 (2018-05-25) | ||
### Bug Fixes | ||
# 1.2.0 (2018-04-12) | ||
- **api-core:** fix usage of Promise ([8fb3de8](https://github.com/Availity/sdk-js/commit/8fb3de8)) | ||
# 2.1.0 (2018-05-24) | ||
### Features | ||
* **api-core:** refactor polling for extending MS ([04c1474](https://github.com/Availity/sdk-js/commit/04c1474)) | ||
- **api-core:** add all method to get all the data from all of the pages ([114519d](https://github.com/Availity/sdk-js/commit/114519d)) | ||
## 2.0.3 (2018-05-10) | ||
### Bug Fixes | ||
## 1.1.1 (2018-03-28) | ||
- **api-core:** allow id to be in the config ([55b55af](https://github.com/Availity/sdk-js/commit/55b55af)) | ||
## 2.0.1 (2018-05-04) | ||
### Bug Fixes | ||
## 1.0.1 (2018-03-26) | ||
- **api-core:** get id out of arguments ([3e525c2](https://github.com/Availity/sdk-js/commit/3e525c2)) | ||
# 2.0.0 (2018-05-04) | ||
### Bug Fixes | ||
* **api-core:** avFiles error handling ([3dd5392](https://github.com/Availity/sdk-js/commit/3dd5392)) | ||
- **api-core:** avSpaces - throw error when no spaceId given ([7c47280](https://github.com/Availity/sdk-js/commit/7c47280)) | ||
# 1.4.0 (2018-04-17) | ||
# 1.2.0 (2018-04-12) | ||
# 1.0.0-alpha.17 (2018-01-18) | ||
### Features | ||
- **api-core:** refactor polling for extending MS ([04c1474](https://github.com/Availity/sdk-js/commit/04c1474)) | ||
## 1.1.1 (2018-03-28) | ||
# 1.0.0-alpha.16 (2018-01-17) | ||
## 1.0.1 (2018-03-26) | ||
### Bug Fixes | ||
- **api-core:** avFiles error handling ([3dd5392](https://github.com/Availity/sdk-js/commit/3dd5392)) | ||
# 1.0.0-alpha.15 (2018-01-12) | ||
# 1.0.0-alpha.17 (2018-01-18) | ||
# 1.0.0-alpha.16 (2018-01-17) | ||
# 1.0.0-alpha.15 (2018-01-12) | ||
# 1.0.0-alpha.14 (2018-01-11) | ||
# 1.0.0-alpha.13 (2018-01-10) | ||
### Features | ||
* **api-core:** add helper function adds name attribute to providers collection ([3b24341](https://github.com/Availity/sdk-js/commit/3b24341)) | ||
- **api-core:** add helper function adds name attribute to providers collection ([3b24341](https://github.com/Availity/sdk-js/commit/3b24341)) | ||
# 1.0.0-alpha.12 (2018-01-09) | ||
# 1.0.0-alpha.11 (2018-01-06) | ||
### Bug Fixes | ||
* **api-core:** resources incorrectly handling config ([9a5de1c](https://github.com/Availity/sdk-js/commit/9a5de1c)) | ||
- **api-core:** resources incorrectly handling config ([9a5de1c](https://github.com/Availity/sdk-js/commit/9a5de1c)) | ||
### Code Refactoring | ||
* **api-core:** pass config object to core classes ([d7b859c](https://github.com/Availity/sdk-js/commit/d7b859c)) | ||
- **api-core:** pass config object to core classes ([d7b859c](https://github.com/Availity/sdk-js/commit/d7b859c)) | ||
### BREAKING CHANGES | ||
* **api-core:** Options to core classes are being passed in as config object instead of parameters. | ||
- **api-core:** Options to core classes are being passed in as config object instead of parameters. | ||
# 1.0.0-alpha.10 (2018-01-04) | ||
### Bug Fixes | ||
* **api-core:** remove/delete should not assume data payloads ([e45a9f6](https://github.com/Availity/sdk-js/commit/e45a9f6)) | ||
- **api-core:** remove/delete should not assume data payloads ([e45a9f6](https://github.com/Availity/sdk-js/commit/e45a9f6)) | ||
### BREAKING CHANGES | ||
* **api-core:** previously remove/delete would assume that data was being passed in the body of the request if the first param of the message signature was NOT a string or number. Now, the method assumes a config object is passed in instead of data. This allows the developers to pass in params or data as they see fit. | ||
- **api-core:** previously remove/delete would assume that data was being passed in the body of the request if the first param of the message signature was NOT a string or number. Now, the method assumes a config object is passed in instead of data. This allows the developers to pass in params or data as they see fit. | ||
# 1.0.0-alpha.9 (2018-01-03) | ||
### Bug Fixes | ||
* **api-core:** provides api param not properly merged with defaults ([5f53e3d](https://github.com/Availity/sdk-js/commit/5f53e3d)) | ||
- **api-core:** provides api param not properly merged with defaults ([5f53e3d](https://github.com/Availity/sdk-js/commit/5f53e3d)) | ||
# 1.0.0-alpha.8 (2018-01-03) | ||
# 1.0.0-alpha.7 (2018-01-03) | ||
### Bug Fixes | ||
* **api-core:** use get instead of query for space name ([84dd26a](https://github.com/Availity/sdk-js/commit/84dd26a)) | ||
- **api-core:** use get instead of query for space name ([84dd26a](https://github.com/Availity/sdk-js/commit/84dd26a)) | ||
# 1.0.0-alpha.6 (2017-12-20) | ||
# 1.0.0-alpha.5 (2017-12-20) | ||
### Bug Fixes | ||
* **api-core:** wrong url for notifcations api ([acafc97](https://github.com/Availity/sdk-js/commit/acafc97)) | ||
- **api-core:** wrong url for notifcations api ([acafc97](https://github.com/Availity/sdk-js/commit/acafc97)) | ||
# 1.0.0-alpha.4 (2017-12-20) | ||
### Bug Fixes | ||
* **api-core:** wrong url for pdf api ([9f4af1c](https://github.com/Availity/sdk-js/commit/9f4af1c)) | ||
- **api-core:** wrong url for pdf api ([9f4af1c](https://github.com/Availity/sdk-js/commit/9f4af1c)) | ||
# 1.0.0-alpha.3 (2017-12-19) | ||
### Bug Fixes | ||
* **api-core:** user.me() should return user object ([715c616](https://github.com/Availity/sdk-js/commit/715c616)) | ||
- **api-core:** user.me() should return user object ([715c616](https://github.com/Availity/sdk-js/commit/715c616)) | ||
# 1.0.0-alpha.2 (2017-12-19) | ||
# 1.0.0-alpha.1 (2017-12-19) | ||
### Bug Fixes | ||
* **api-core:** remove default after* response transformations ([6f17d3a](https://github.com/Availity/sdk-js/commit/6f17d3a)) | ||
- **api-core:** remove default after\* response transformations ([6f17d3a](https://github.com/Availity/sdk-js/commit/6f17d3a)) | ||
### BREAKING CHANGES | ||
* **api-core:** The core API classes no longer apply after* transformations on the response. Previously, only the collection data was being returned when making API calls which made it difficult to react to the metadata around the response (e.g. pagination). Developers will have to unwrap the response manually. | ||
- **api-core:** The core API classes no longer apply after\* transformations on the response. Previously, only the collection data was being returned when making API calls which made it difficult to react to the metadata around the response (e.g. pagination). Developers will have to unwrap the response manually. | ||
@@ -547,342 +568,273 @@ Example response callback: | ||
# 1.0.0-alpha.0 (2017-12-05) | ||
### Features | ||
* **api-core:** add post and delete as synonyms for create and update ([0150680](https://github.com/Availity/sdk-js/commit/0150680)) | ||
* **api-core:** add spaces helper methods ([72de394](https://github.com/Availity/sdk-js/commit/72de394)) | ||
* **api-core, api-angular api-react:** add pdf api ([b84a16f](https://github.com/Availity/sdk-js/commit/b84a16f)) | ||
- **api-core:** add post and delete as synonyms for create and update ([0150680](https://github.com/Availity/sdk-js/commit/0150680)) | ||
- **api-core:** add spaces helper methods ([72de394](https://github.com/Availity/sdk-js/commit/72de394)) | ||
- **api-core, api-angular api-react:** add pdf api ([b84a16f](https://github.com/Availity/sdk-js/commit/b84a16f)) | ||
<a name="3.0.0"></a> | ||
<a name="3.0.0"></a> | ||
# 3.0.0 (2018-11-20) | ||
### Bug Fixes | ||
* **api-core:** Allow array for permissions ([#67](https://github.com/Availity/sdk-js/issues/67)) ([98adf76](https://github.com/Availity/sdk-js/commit/98adf76)) | ||
* **api-core:** typo fix ([f543296](https://github.com/Availity/sdk-js/commit/f543296)) | ||
- **api-core:** Allow array for permissions ([#67](https://github.com/Availity/sdk-js/issues/67)) ([98adf76](https://github.com/Availity/sdk-js/commit/98adf76)) | ||
- **api-core:** typo fix ([f543296](https://github.com/Availity/sdk-js/commit/f543296)) | ||
### Features | ||
* **api-core:** add example response for file delivery ([edc4df5](https://github.com/Availity/sdk-js/commit/edc4df5)) | ||
* **api-core:** add file upload delivery batch api ([eff0a3c](https://github.com/Availity/sdk-js/commit/eff0a3c)) | ||
- **api-core:** add example response for file delivery ([edc4df5](https://github.com/Availity/sdk-js/commit/edc4df5)) | ||
- **api-core:** add file upload delivery batch api ([eff0a3c](https://github.com/Availity/sdk-js/commit/eff0a3c)) | ||
### BREAKING CHANGES | ||
* **api-core:** The query to the API has been changed. To get the previous behavior, supply a custom paramSerializer. | ||
- **api-core:** The query to the API has been changed. To get the previous behavior, supply a custom paramSerializer. | ||
<a name="2.6.0"></a> | ||
<a name="2.6.0"></a> | ||
# 2.6.0 (2018-08-23) | ||
### Features | ||
* **api-core:** helper function for settings api ([4d405a7](https://github.com/Availity/sdk-js/commit/4d405a7)) | ||
* **api-core:** helper function for settings api ([#64](https://github.com/Availity/sdk-js/issues/64)) ([f247235](https://github.com/Availity/sdk-js/commit/f247235)) | ||
- **api-core:** helper function for settings api ([4d405a7](https://github.com/Availity/sdk-js/commit/4d405a7)) | ||
- **api-core:** helper function for settings api ([#64](https://github.com/Availity/sdk-js/issues/64)) ([f247235](https://github.com/Availity/sdk-js/commit/f247235)) | ||
<a name="2.5.0"></a> | ||
<a name="2.5.0"></a> | ||
# 2.5.0 (2018-08-20) | ||
<a name="2.4.8"></a> | ||
<a name="2.4.8"></a> | ||
## 2.4.8 (2018-08-06) | ||
### Bug Fixes | ||
* **api-core:** spread args for aliases ([5c7516b](https://github.com/Availity/sdk-js/commit/5c7516b)) | ||
- **api-core:** spread args for aliases ([5c7516b](https://github.com/Availity/sdk-js/commit/5c7516b)) | ||
<a name="2.4.7"></a> | ||
<a name="2.4.7"></a> | ||
## 2.4.7 (2018-08-02) | ||
### Bug Fixes | ||
* **api-core:** check for lowercase location as well ([4a4a9a0](https://github.com/Availity/sdk-js/commit/4a4a9a0)) | ||
- **api-core:** check for lowercase location as well ([4a4a9a0](https://github.com/Availity/sdk-js/commit/4a4a9a0)) | ||
<a name="2.4.6"></a> | ||
<a name="2.4.6"></a> | ||
## 2.4.6 (2018-08-02) | ||
### Bug Fixes | ||
* **analytics-core:** fix non-click events ([fce9b26](https://github.com/Availity/sdk-js/commit/fce9b26)) | ||
- **analytics-core:** fix non-click events ([fce9b26](https://github.com/Availity/sdk-js/commit/fce9b26)) | ||
<a name="2.4.0"></a> | ||
<a name="2.4.0"></a> | ||
# 2.4.0 (2018-07-12) | ||
<a name="2.3.3"></a> | ||
<a name="2.3.3"></a> | ||
## 2.3.3 (2018-07-12) | ||
<a name="2.2.0"></a> | ||
<a name="2.2.0"></a> | ||
# 2.2.0 (2018-06-29) | ||
### Bug Fixes | ||
* **api-core:** format postGet payload to standard ([5b885cf](https://github.com/Availity/sdk-js/commit/5b885cf)) | ||
- **api-core:** format postGet payload to standard ([5b885cf](https://github.com/Availity/sdk-js/commit/5b885cf)) | ||
<a name="2.1.2"></a> | ||
<a name="2.1.2"></a> | ||
## 2.1.2 (2018-06-13) | ||
### Bug Fixes | ||
* **api-core:** attempts count not increasing ([2e414a3](https://github.com/Availity/sdk-js/commit/2e414a3)) | ||
- **api-core:** attempts count not increasing ([2e414a3](https://github.com/Availity/sdk-js/commit/2e414a3)) | ||
<a name="2.1.1"></a> | ||
<a name="2.1.1"></a> | ||
## 2.1.1 (2018-05-25) | ||
### Bug Fixes | ||
* **api-core:** fix usage of Promise ([8fb3de8](https://github.com/Availity/sdk-js/commit/8fb3de8)) | ||
- **api-core:** fix usage of Promise ([8fb3de8](https://github.com/Availity/sdk-js/commit/8fb3de8)) | ||
<a name="2.1.0"></a> | ||
<a name="2.1.0"></a> | ||
# 2.1.0 (2018-05-24) | ||
### Features | ||
* **api-core:** add all method to get all the data from all of the pages ([114519d](https://github.com/Availity/sdk-js/commit/114519d)) | ||
- **api-core:** add all method to get all the data from all of the pages ([114519d](https://github.com/Availity/sdk-js/commit/114519d)) | ||
<a name="2.0.3"></a> | ||
<a name="2.0.3"></a> | ||
## 2.0.3 (2018-05-10) | ||
### Bug Fixes | ||
* **api-core:** allow id to be in the config ([55b55af](https://github.com/Availity/sdk-js/commit/55b55af)) | ||
- **api-core:** allow id to be in the config ([55b55af](https://github.com/Availity/sdk-js/commit/55b55af)) | ||
<a name="2.0.1"></a> | ||
<a name="2.0.1"></a> | ||
## 2.0.1 (2018-05-04) | ||
### Bug Fixes | ||
* **api-core:** get id out of arguments ([3e525c2](https://github.com/Availity/sdk-js/commit/3e525c2)) | ||
- **api-core:** get id out of arguments ([3e525c2](https://github.com/Availity/sdk-js/commit/3e525c2)) | ||
<a name="2.0.0"></a> | ||
<a name="2.0.0"></a> | ||
# 2.0.0 (2018-05-04) | ||
### Bug Fixes | ||
* **api-core:** avSpaces - throw error when no spaceId given ([7c47280](https://github.com/Availity/sdk-js/commit/7c47280)) | ||
- **api-core:** avSpaces - throw error when no spaceId given ([7c47280](https://github.com/Availity/sdk-js/commit/7c47280)) | ||
<a name="1.4.0"></a> | ||
<a name="1.4.0"></a> | ||
# 1.4.0 (2018-04-17) | ||
<a name="1.2.0"></a> | ||
<a name="1.2.0"></a> | ||
# 1.2.0 (2018-04-12) | ||
### Features | ||
* **api-core:** refactor polling for extending MS ([04c1474](https://github.com/Availity/sdk-js/commit/04c1474)) | ||
- **api-core:** refactor polling for extending MS ([04c1474](https://github.com/Availity/sdk-js/commit/04c1474)) | ||
<a name="1.1.1"></a> | ||
<a name="1.1.1"></a> | ||
## 1.1.1 (2018-03-28) | ||
<a name="1.0.1"></a> | ||
<a name="1.0.1"></a> | ||
## 1.0.1 (2018-03-26) | ||
### Bug Fixes | ||
* **api-core:** avFiles error handling ([3dd5392](https://github.com/Availity/sdk-js/commit/3dd5392)) | ||
- **api-core:** avFiles error handling ([3dd5392](https://github.com/Availity/sdk-js/commit/3dd5392)) | ||
<a name="1.0.0-alpha.17"></a> | ||
<a name="1.0.0-alpha.17"></a> | ||
# 1.0.0-alpha.17 (2018-01-18) | ||
<a name="1.0.0-alpha.16"></a> | ||
<a name="1.0.0-alpha.16"></a> | ||
# 1.0.0-alpha.16 (2018-01-17) | ||
<a name="1.0.0-alpha.15"></a> | ||
<a name="1.0.0-alpha.15"></a> | ||
# 1.0.0-alpha.15 (2018-01-12) | ||
<a name="1.0.0-alpha.14"></a> | ||
<a name="1.0.0-alpha.14"></a> | ||
# 1.0.0-alpha.14 (2018-01-11) | ||
<a name="1.0.0-alpha.13"></a> | ||
<a name="1.0.0-alpha.13"></a> | ||
# 1.0.0-alpha.13 (2018-01-10) | ||
### Features | ||
* **api-core:** add helper function adds name attribute to providers collection ([3b24341](https://github.com/Availity/sdk-js/commit/3b24341)) | ||
- **api-core:** add helper function adds name attribute to providers collection ([3b24341](https://github.com/Availity/sdk-js/commit/3b24341)) | ||
<a name="1.0.0-alpha.12"></a> | ||
<a name="1.0.0-alpha.12"></a> | ||
# 1.0.0-alpha.12 (2018-01-09) | ||
<a name="1.0.0-alpha.11"></a> | ||
<a name="1.0.0-alpha.11"></a> | ||
# 1.0.0-alpha.11 (2018-01-06) | ||
### Bug Fixes | ||
* **api-core:** resources incorrectly handling config ([9a5de1c](https://github.com/Availity/sdk-js/commit/9a5de1c)) | ||
- **api-core:** resources incorrectly handling config ([9a5de1c](https://github.com/Availity/sdk-js/commit/9a5de1c)) | ||
### Code Refactoring | ||
* **api-core:** pass config object to core classes ([d7b859c](https://github.com/Availity/sdk-js/commit/d7b859c)) | ||
- **api-core:** pass config object to core classes ([d7b859c](https://github.com/Availity/sdk-js/commit/d7b859c)) | ||
### BREAKING CHANGES | ||
* **api-core:** Options to core classes are being passed in as config object instead of parameters. | ||
- **api-core:** Options to core classes are being passed in as config object instead of parameters. | ||
<a name="1.0.0-alpha.10"></a> | ||
<a name="1.0.0-alpha.10"></a> | ||
# 1.0.0-alpha.10 (2018-01-04) | ||
### Bug Fixes | ||
* **api-core:** remove/delete should not assume data payloads ([e45a9f6](https://github.com/Availity/sdk-js/commit/e45a9f6)) | ||
- **api-core:** remove/delete should not assume data payloads ([e45a9f6](https://github.com/Availity/sdk-js/commit/e45a9f6)) | ||
### BREAKING CHANGES | ||
* **api-core:** previously remove/delete would assume that data was being passed in the body of the request if the first param of the message signature was NOT a string or number. Now, the method assumes a config object is passed in instead of data. This allows the developers to pass in params or data as they see fit. | ||
- **api-core:** previously remove/delete would assume that data was being passed in the body of the request if the first param of the message signature was NOT a string or number. Now, the method assumes a config object is passed in instead of data. This allows the developers to pass in params or data as they see fit. | ||
<a name="1.0.0-alpha.9"></a> | ||
<a name="1.0.0-alpha.9"></a> | ||
# 1.0.0-alpha.9 (2018-01-03) | ||
### Bug Fixes | ||
* **api-core:** provides api param not properly merged with defaults ([5f53e3d](https://github.com/Availity/sdk-js/commit/5f53e3d)) | ||
- **api-core:** provides api param not properly merged with defaults ([5f53e3d](https://github.com/Availity/sdk-js/commit/5f53e3d)) | ||
<a name="1.0.0-alpha.8"></a> | ||
<a name="1.0.0-alpha.8"></a> | ||
# 1.0.0-alpha.8 (2018-01-03) | ||
<a name="1.0.0-alpha.7"></a> | ||
<a name="1.0.0-alpha.7"></a> | ||
# 1.0.0-alpha.7 (2018-01-03) | ||
### Bug Fixes | ||
* **api-core:** use get instead of query for space name ([84dd26a](https://github.com/Availity/sdk-js/commit/84dd26a)) | ||
- **api-core:** use get instead of query for space name ([84dd26a](https://github.com/Availity/sdk-js/commit/84dd26a)) | ||
<a name="1.0.0-alpha.6"></a> | ||
<a name="1.0.0-alpha.6"></a> | ||
# 1.0.0-alpha.6 (2017-12-20) | ||
<a name="1.0.0-alpha.5"></a> | ||
<a name="1.0.0-alpha.5"></a> | ||
# 1.0.0-alpha.5 (2017-12-20) | ||
### Bug Fixes | ||
* **api-core:** wrong url for notifcations api ([acafc97](https://github.com/Availity/sdk-js/commit/acafc97)) | ||
- **api-core:** wrong url for notifcations api ([acafc97](https://github.com/Availity/sdk-js/commit/acafc97)) | ||
<a name="1.0.0-alpha.4"></a> | ||
<a name="1.0.0-alpha.4"></a> | ||
# 1.0.0-alpha.4 (2017-12-20) | ||
### Bug Fixes | ||
* **api-core:** wrong url for pdf api ([9f4af1c](https://github.com/Availity/sdk-js/commit/9f4af1c)) | ||
- **api-core:** wrong url for pdf api ([9f4af1c](https://github.com/Availity/sdk-js/commit/9f4af1c)) | ||
<a name="1.0.0-alpha.3"></a> | ||
<a name="1.0.0-alpha.3"></a> | ||
# 1.0.0-alpha.3 (2017-12-19) | ||
### Bug Fixes | ||
* **api-core:** user.me() should return user object ([715c616](https://github.com/Availity/sdk-js/commit/715c616)) | ||
- **api-core:** user.me() should return user object ([715c616](https://github.com/Availity/sdk-js/commit/715c616)) | ||
<a name="1.0.0-alpha.2"></a> | ||
<a name="1.0.0-alpha.2"></a> | ||
# 1.0.0-alpha.2 (2017-12-19) | ||
<a name="1.0.0-alpha.1"></a> | ||
<a name="1.0.0-alpha.1"></a> | ||
# 1.0.0-alpha.1 (2017-12-19) | ||
### Bug Fixes | ||
* **api-core:** remove default after* response transformations ([6f17d3a](https://github.com/Availity/sdk-js/commit/6f17d3a)) | ||
- **api-core:** remove default after\* response transformations ([6f17d3a](https://github.com/Availity/sdk-js/commit/6f17d3a)) | ||
### BREAKING CHANGES | ||
* **api-core:** The core API classes no longer apply after* transformations on the response. Previously, only the collection data was being returned when making API calls which made it difficult to react to the metadata around the response (e.g. pagination). Developers will have to unwrap the response manually. | ||
- **api-core:** The core API classes no longer apply after\* transformations on the response. Previously, only the collection data was being returned when making API calls which made it difficult to react to the metadata around the response (e.g. pagination). Developers will have to unwrap the response manually. | ||
@@ -897,12 +849,10 @@ Example response callback: | ||
<a name="1.0.0-alpha.0"></a> | ||
<a name="1.0.0-alpha.0"></a> | ||
# 1.0.0-alpha.0 (2017-12-05) | ||
### Features | ||
* **api-core:** add post and delete as synonyms for create and update ([0150680](https://github.com/Availity/sdk-js/commit/0150680)) | ||
* **api-core:** add spaces helper methods ([72de394](https://github.com/Availity/sdk-js/commit/72de394)) | ||
* **api-core, api-angular api-react:** add pdf api ([b84a16f](https://github.com/Availity/sdk-js/commit/b84a16f)) | ||
- **api-core:** add post and delete as synonyms for create and update ([0150680](https://github.com/Availity/sdk-js/commit/0150680)) | ||
- **api-core:** add spaces helper methods ([72de394](https://github.com/Availity/sdk-js/commit/72de394)) | ||
- **api-core, api-angular api-react:** add pdf api ([b84a16f](https://github.com/Availity/sdk-js/commit/b84a16f)) |
610
lib/api.js
"use strict"; | ||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
@@ -10,8 +8,12 @@ | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); | ||
var avLocalStorage = _interopRequireWildcard(require("@availity/localstorage-core")); | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _qs = _interopRequireDefault(require("qs")); | ||
@@ -23,13 +25,10 @@ | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
var AvApi = /*#__PURE__*/function () { | ||
function AvApi(_ref) { | ||
var http = _ref.http, | ||
promise = _ref.promise, | ||
merge = _ref.merge, | ||
config = _ref.config; | ||
(0, _classCallCheck2["default"])(this, AvApi); | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
class AvApi { | ||
constructor({ | ||
http: http, | ||
promise: promise, | ||
merge: merge, | ||
config: config | ||
}) { | ||
if (!http || !config || !promise || !merge) { | ||
@@ -42,320 +41,437 @@ throw new Error('[http], [promise], [config], and [merge] must be defined'); | ||
this.merge = merge; | ||
this.defaultConfig = this.merge({}, _options.default.API, config); | ||
this.defaultConfig = this.merge({}, _options["default"].API, config); | ||
} // get the merged config | ||
config(config = {}) { | ||
return this.merge({}, this.defaultConfig, config); | ||
} | ||
(0, _createClass2["default"])(AvApi, [{ | ||
key: "config", | ||
value: function config() { | ||
var _config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
addParams(params = {}, config = {}, newObj = true) { | ||
const output = newObj ? _objectSpread({ | ||
params: {} | ||
}, config) : config; | ||
if (!newObj) { | ||
output.params = output.params || {}; | ||
return this.merge({}, this.defaultConfig, _config); | ||
} | ||
}, { | ||
key: "addParams", | ||
value: function addParams() { | ||
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var newObj = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; | ||
var output = newObj ? (0, _objectSpread2["default"])({ | ||
params: {} | ||
}, config) : config; | ||
output.params = _objectSpread({}, output.params, {}, params); | ||
return output; | ||
} // set the cache parameters | ||
if (!newObj) { | ||
output.params = output.params || {}; | ||
} | ||
cacheParams(config) { | ||
const params = {}; | ||
if (config.cacheBust) { | ||
params.cacheBust = this.getCacheBustVal(config.cacheBust, () => Date.now()); | ||
output.params = (0, _objectSpread2["default"])({}, output.params, {}, params); | ||
return output; | ||
} | ||
}, { | ||
key: "getSessionBust", | ||
value: function getSessionBust() { | ||
return window.localStorage.getItem('avCacheBust'); | ||
} // set the cache parameters | ||
if (config.pageBust) { | ||
params.pageBust = this.getCacheBustVal(config.pageBust, () => this.getPageBust()); | ||
} | ||
}, { | ||
key: "cacheParams", | ||
value: function cacheParams(config) { | ||
var _this = this; | ||
if (config.sessionBust) { | ||
params.sessionBust = this.getCacheBustVal(config.sessionBust, () => avLocalStorage.getSessionBust() || this.getPageBust()); | ||
} | ||
var params = {}; | ||
return this.addParams(params, config, false); | ||
} // get the cache value with default function | ||
if (config.cacheBust) { | ||
params.cacheBust = this.getCacheBustVal(config.cacheBust, function () { | ||
return Date.now(); | ||
}); | ||
} | ||
if (config.pageBust) { | ||
params.pageBust = this.getCacheBustVal(config.pageBust, function () { | ||
return _this.getPageBust(); | ||
}); | ||
} | ||
getCacheBustVal(cacheBust, defaultFn) { | ||
if (!cacheBust) { | ||
return undefined; | ||
} | ||
if (config.sessionBust) { | ||
params.sessionBust = this.getCacheBustVal(config.sessionBust, function () { | ||
return _this.getSessionBust() || _this.getPageBust(); | ||
}); | ||
} | ||
if (typeof cacheBust === 'boolean' && defaultFn) { | ||
return defaultFn(); | ||
} | ||
return this.addParams(params, config, false); | ||
} // get the cache value with default function | ||
if (typeof cacheBust === 'function') { | ||
return cacheBust(); | ||
} | ||
}, { | ||
key: "getCacheBustVal", | ||
value: function getCacheBustVal(cacheBust, defaultFn) { | ||
if (!cacheBust) { | ||
return undefined; | ||
} | ||
return cacheBust; | ||
} // get pagebust value, make sure it is instantiated first | ||
if (typeof cacheBust === 'boolean' && defaultFn) { | ||
return defaultFn(); | ||
} | ||
if (typeof cacheBust === 'function') { | ||
return cacheBust(); | ||
} | ||
getPageBust() { | ||
if (typeof this.pageBustValue === 'undefined') { | ||
this.setPageBust(); | ||
} | ||
return cacheBust; | ||
} // get pagebust value, make sure it is instantiated first | ||
return this.pageBustValue; | ||
} // set the page bust value to given value or timestamp | ||
}, { | ||
key: "getPageBust", | ||
value: function getPageBust() { | ||
if (typeof this.pageBustValue === 'undefined') { | ||
this.setPageBust(); | ||
} | ||
return this.pageBustValue; | ||
} // set the page bust value to given value or timestamp | ||
setPageBust(value) { | ||
this.pageBustValue = typeof value === 'undefined' ? Date.now() : value; | ||
} // get final url from config | ||
}, { | ||
key: "setPageBust", | ||
value: function setPageBust(value) { | ||
this.pageBustValue = typeof value === 'undefined' ? Date.now() : value; | ||
} // get final url from config | ||
}, { | ||
key: "getUrl", | ||
value: function getUrl(config) { | ||
var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; | ||
getUrl(config, id = '') { | ||
if (!config.api) { | ||
return config.url; | ||
} | ||
if (!config.api) { | ||
return config.url; | ||
} | ||
const path = config.path, | ||
var path = config.path, | ||
version = config.version, | ||
name = config.name, | ||
url = config.url; | ||
let parts = []; | ||
var parts = []; | ||
if (name) { | ||
parts = ['', path, version, name, id]; | ||
} else { | ||
parts = [url, id]; | ||
} // join parts, remove multiple /'s and trailing / | ||
if (name) { | ||
parts = ['', path, version, name, id]; | ||
} else { | ||
parts = [url, id]; | ||
} // join parts, remove multiple /'s and trailing / | ||
return parts.join('/').replace(/[/]+/g, '/').replace(/\/$/, ''); | ||
} | ||
return parts.join('/').replace(/[/]+/g, '/').replace(/\/$/, ''); | ||
} | ||
}, { | ||
key: "getRequestUrl", | ||
value: function getRequestUrl() { | ||
return this.getUrl(this.config()); | ||
} // return location if should poll otherwise false | ||
getRequestUrl() { | ||
return this.getUrl(this.config()); | ||
} // return location if should poll otherwise false | ||
getLocation(response) { | ||
let locationUrl; | ||
const config = response.config, | ||
}, { | ||
key: "getLocation", | ||
value: function getLocation(response) { | ||
var locationUrl; | ||
var config = response.config, | ||
_response$headers = response.headers, | ||
headers = _response$headers === void 0 ? {} : _response$headers; | ||
const getHeader = config.getHeader, | ||
var getHeader = config.getHeader, | ||
base = config.base; | ||
const location = headers.location, | ||
var location = headers.location, | ||
Location = headers.Location; | ||
if (getHeader) { | ||
locationUrl = getHeader(response, 'Location'); | ||
} else { | ||
locationUrl = location || Location; | ||
} | ||
if (getHeader) { | ||
locationUrl = getHeader(response, 'Location'); | ||
} else { | ||
locationUrl = location || Location; | ||
} | ||
return (0, _resolveUrl.default)({ | ||
relative: locationUrl, | ||
base: base | ||
}); | ||
} // condition for calls that should continue polling | ||
return (0, _resolveUrl["default"])({ | ||
relative: locationUrl, | ||
base: base | ||
}); | ||
} // condition for calls that should continue polling | ||
}, { | ||
key: "shouldPoll", | ||
value: function shouldPoll(response) { | ||
return response && response.config && response.config.polling && response.status === 202 && response.config.attempt < response.config.pollingIntervals.length; | ||
} // handle response with possible polling | ||
shouldPoll(response) { | ||
return response && response.config && response.config.polling && response.status === 202 && response.config.attempt < response.config.pollingIntervals.length; | ||
} // handle response with possible polling | ||
}, { | ||
key: "onResponse", | ||
value: function onResponse(response, afterResponse) { | ||
var _this2 = this; | ||
if (this.shouldPoll(response)) { | ||
var newConfig = this.config(response.config); | ||
var pollingUrl = this.getLocation(response); | ||
onResponse(response, afterResponse) { | ||
if (this.shouldPoll(response)) { | ||
const newConfig = this.config(response.config); | ||
const pollingUrl = this.getLocation(response); | ||
if (pollingUrl) { | ||
newConfig.method = this.defaultConfig.pollingMethod; | ||
newConfig.url = pollingUrl; | ||
newConfig.cache = false; | ||
return new this.Promise(resolve => { | ||
setTimeout(resolve, newConfig.pollingIntervals[newConfig.attempt] || 1000); | ||
}).then(() => this.request(newConfig, afterResponse)); | ||
if (pollingUrl) { | ||
newConfig.method = this.defaultConfig.pollingMethod; | ||
newConfig.url = pollingUrl; | ||
newConfig.cache = false; | ||
return new this.Promise(function (resolve) { | ||
setTimeout(resolve, newConfig.pollingIntervals[newConfig.attempt] || 1000); | ||
}).then(function () { | ||
return _this2.request(newConfig, afterResponse); | ||
}); | ||
} | ||
} | ||
} | ||
return afterResponse ? afterResponse(response) : response; | ||
} // make request to http | ||
return afterResponse ? afterResponse(response) : response; | ||
} // make request to http | ||
}, { | ||
key: "request", | ||
value: function request(config, afterResponse) { | ||
var _this3 = this; | ||
request(config, afterResponse) { | ||
if (config.polling) { | ||
config.attempt = config.attempt || 0; | ||
config.attempt += 1; | ||
} | ||
if (config.polling) { | ||
config.attempt = config.attempt || 0; | ||
config.attempt += 1; | ||
} | ||
return this.http(config).then(response => this.onResponse(response, afterResponse)); | ||
} // post request | ||
return this.http(config).then(function (response) { | ||
return _this3.onResponse(response, afterResponse); | ||
}); | ||
} // post request | ||
}, { | ||
key: "create", | ||
value: function create(data, config) { | ||
if (!data) { | ||
throw new Error('called method without [data]'); | ||
} | ||
create(data, config) { | ||
if (!data) { | ||
throw new Error('called method without [data]'); | ||
} | ||
config = this.config(config); | ||
config.method = 'POST'; | ||
config.url = this.getUrl(config); | ||
config.data = data; | ||
var beforeFunc = this.beforeCreate || this.beforePost; | ||
config = this.config(config); | ||
config.method = 'POST'; | ||
config.url = this.getUrl(config); | ||
config.data = data; | ||
const beforeFunc = this.beforeCreate || this.beforePost; | ||
if (beforeFunc) { | ||
config.data = beforeFunc(config.data); | ||
} | ||
if (beforeFunc) { | ||
config.data = beforeFunc(config.data); | ||
return this.request(config, this.afterCreate || this.afterPost); | ||
} | ||
}, { | ||
key: "sendBeacon", | ||
value: function sendBeacon(data, config) { | ||
if (!data) { | ||
throw new Error('called method without [data]'); | ||
} | ||
return this.request(config, this.afterCreate || this.afterPost); | ||
} | ||
config = this.config(config); | ||
config.method = 'POST'; | ||
config.url = this.getUrl(config); | ||
config.data = data; | ||
var beforeFunc = this.beforeCreate || this.beforePost; | ||
post(data, config) { | ||
return this.create(data, config); | ||
} // post request with method-override to get | ||
if (beforeFunc) { | ||
config.data = beforeFunc(config.data); | ||
} | ||
if (navigator.sendBeacon) { | ||
var result = navigator.sendBeacon(config.url, new Blob([config.data], { | ||
type: 'application/x-www-form-urlencoded' | ||
})); // A truthy return value from navigator.sendBeacon means the browser successfully queued the request | ||
postGet(data, config) { | ||
if (!data) { | ||
throw new Error('called method without [data]'); | ||
} | ||
if (result) return this.Promise.resolve(); | ||
} // Fall back to XHR if browser does not support navigator.sendBeacon or browser fails to queue the request | ||
config = this.config(config); | ||
config.method = 'POST'; | ||
config.headers = config.headers || {}; | ||
config.headers['X-HTTP-Method-Override'] = 'GET'; | ||
config.headers['Content-Type'] = config.headers['Content-Type'] || 'application/x-www-form-urlencoded'; | ||
config.url = this.getUrl(config); | ||
config.data = data; | ||
if (this.beforePostGet) { | ||
config.data = this.beforePostGet(config.data); | ||
return this.request(config, this.afterCreate || this.afterPost); | ||
} | ||
}, { | ||
key: "post", | ||
value: function post(data, config) { | ||
return this.create(data, config); | ||
} // post request with method-override to get | ||
if (typeof config.data !== 'string' && config.headers['Content-Type'] === 'application/x-www-form-urlencoded') { | ||
config.data = _qs.default.stringify(config.data, { | ||
encode: false, | ||
arrayFormat: 'repeat', | ||
indices: false, | ||
allowDots: true | ||
}); | ||
} | ||
}, { | ||
key: "postGet", | ||
value: function postGet(data, config) { | ||
if (!data) { | ||
throw new Error('called method without [data]'); | ||
} | ||
return this.request(config, this.afterPostGet); | ||
} // get request with id | ||
config = this.config(config); | ||
config.method = 'POST'; | ||
config.headers = config.headers || {}; | ||
config.headers['X-HTTP-Method-Override'] = 'GET'; | ||
config.headers['Content-Type'] = config.headers['Content-Type'] || 'application/x-www-form-urlencoded'; | ||
config.url = this.getUrl(config); | ||
config.data = data; | ||
if (this.beforePostGet) { | ||
config.data = this.beforePostGet(config.data); | ||
} | ||
get(id, config) { | ||
if (!id) { | ||
throw new Error('called method without [id]'); | ||
} | ||
if (typeof config.data !== 'string' && config.headers['Content-Type'] === 'application/x-www-form-urlencoded') { | ||
config.data = _qs["default"].stringify(config.data, { | ||
encode: false, | ||
arrayFormat: 'repeat', | ||
indices: false, | ||
allowDots: true | ||
}); | ||
} | ||
config = this.config(config); | ||
config.method = 'GET'; | ||
config.url = this.getUrl(config, id); | ||
config = this.cacheParams(config); | ||
return this.request(config, this.afterGet); | ||
} // get request with just params | ||
return this.request(config, this.afterPostGet); | ||
} // get request with id | ||
}, { | ||
key: "get", | ||
value: function get(id, config) { | ||
if (!id) { | ||
throw new Error('called method without [id]'); | ||
} | ||
query(config) { | ||
config = this.config(config); | ||
config.method = 'GET'; | ||
config.url = this.getUrl(config); | ||
config = this.cacheParams(config); | ||
return this.request(config, this.afterQuery); | ||
} | ||
config = this.config(config); | ||
config.method = 'GET'; | ||
config.url = this.getUrl(config, id); | ||
config = this.cacheParams(config); | ||
return this.request(config, this.afterGet); | ||
} // get request with just params | ||
all(config) { | ||
return this.query(config).then(resp => { | ||
const key = this.getQueryResultKey(resp.data); | ||
const totalPages = Math.ceil(resp.data.totalCount / resp.data.limit); | ||
const result = resp.data[key] || []; | ||
}, { | ||
key: "query", | ||
value: function query(config) { | ||
config = this.config(config); | ||
config.method = 'GET'; | ||
config.url = this.getUrl(config); | ||
config = this.cacheParams(config); | ||
return this.request(config, this.afterQuery); | ||
} | ||
}, { | ||
key: "all", | ||
value: function all(config) { | ||
var _this4 = this; | ||
if (totalPages > 1) { | ||
const otherPages = []; | ||
return this.query(config).then(function (resp) { | ||
var key = _this4.getQueryResultKey(resp.data); | ||
for (let i = 0; i < totalPages - 1; i += 1) { | ||
otherPages[i] = i + 2; | ||
} | ||
/* eslint-disable promise/no-nesting */ | ||
var totalPages = Math.ceil(resp.data.totalCount / resp.data.limit); | ||
var result = resp.data[key] || []; | ||
if (totalPages > 1) { | ||
var otherPages = []; | ||
return this.Promise.all(otherPages.map(page => this.getPage(page, config, resp.data.limit).then(pageResp => pageResp.data[key] || []))).then(pages => result.concat(...pages)); | ||
} | ||
for (var i = 0; i < totalPages - 1; i += 1) { | ||
otherPages[i] = i + 2; | ||
} | ||
return result; | ||
}); | ||
} | ||
return _this4.Promise.all(otherPages.map(function (page) { | ||
return _this4.getPage(page, config, resp.data.limit).then(function (pageResp) { | ||
return pageResp.data[key] || []; | ||
}); | ||
})).then(function (pages) { | ||
return result.concat.apply(result, (0, _toConsumableArray2["default"])(pages)); | ||
}); | ||
} | ||
getQueryResultKey(data) { | ||
return Object.keys(data).filter(key => Array.isArray(data[key]))[0]; | ||
} | ||
return result; | ||
}); | ||
} | ||
}, { | ||
key: "getQueryResultKey", | ||
value: function getQueryResultKey(data) { | ||
return Object.keys(data).filter(function (key) { | ||
return Array.isArray(data[key]); | ||
})[0]; | ||
} | ||
}, { | ||
key: "getResult", | ||
value: function getResult(data) { | ||
return data[this.getQueryResultKey(data)]; | ||
} | ||
}, { | ||
key: "getPage", | ||
value: function getPage() { | ||
var page = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; | ||
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var limit = arguments.length > 2 ? arguments[2] : undefined; | ||
limit = limit || config.params && config.params.limit || 50; | ||
var offset = (page - 1) * limit; | ||
return this.query(this.addParams({ | ||
offset: offset, | ||
limit: limit | ||
}, config, false)); | ||
} // put request | ||
getResult(data) { | ||
return data[this.getQueryResultKey(data)]; | ||
} | ||
}, { | ||
key: "update", | ||
value: function update(id, data, config) { | ||
if (typeof id !== 'string' && typeof id !== 'number') { | ||
config = data; | ||
data = id; | ||
id = ''; | ||
} | ||
getPage(page = 1, config = {}, limit) { | ||
limit = limit || config.params && config.params.limit || 50; | ||
const offset = (page - 1) * limit; | ||
return this.query(this.addParams({ | ||
offset: offset, | ||
limit: limit | ||
}, config, false)); | ||
} // put request | ||
config = this.config(config); | ||
config.method = 'PUT'; | ||
config.url = this.getUrl(config, id); | ||
config.data = data; | ||
var beforeFunc = this.beforeUpdate || this.beforePut; | ||
if (beforeFunc) { | ||
config.data = beforeFunc(config.data); | ||
} | ||
update(id, data, config) { | ||
if (typeof id !== 'string' && typeof id !== 'number') { | ||
config = data; | ||
data = id; | ||
id = ''; | ||
return this.request(config, this.afterUpdate || this.afterPut); | ||
} | ||
}, { | ||
key: "put", | ||
value: function put() { | ||
return this.update.apply(this, arguments); | ||
} // patch request | ||
config = this.config(config); | ||
config.method = 'PUT'; | ||
config.url = this.getUrl(config, id); | ||
config.data = data; | ||
const beforeFunc = this.beforeUpdate || this.beforePut; | ||
}, { | ||
key: "patch", | ||
value: function patch(id, data, config) { | ||
if (typeof id !== 'string' && typeof id !== 'number') { | ||
config = data; | ||
data = id; | ||
id = ''; | ||
} | ||
if (beforeFunc) { | ||
config.data = beforeFunc(config.data); | ||
} | ||
config = this.config(config); | ||
config.method = 'PATCH'; | ||
config.url = this.getUrl(config, id); | ||
config.data = data; | ||
var beforeFunc = this.beforePatch; | ||
return this.request(config, this.afterUpdate || this.afterPut); | ||
} | ||
if (beforeFunc) { | ||
config.data = beforeFunc(config.data); | ||
} | ||
put(...args) { | ||
return this.update(...args); | ||
} // delete request | ||
return this.request(config, this.afterPatch); | ||
} // delete request | ||
}, { | ||
key: "remove", | ||
value: function remove(id, config) { | ||
if (typeof id !== 'string' && typeof id !== 'number') { | ||
config = id; | ||
id = ''; | ||
} | ||
remove(id, config) { | ||
if (typeof id !== 'string' && typeof id !== 'number') { | ||
config = id; | ||
id = ''; | ||
} | ||
config = this.config(config); | ||
config.method = 'DELETE'; | ||
config.url = this.getUrl(config, id); | ||
var beforeFunc = this.beforeRemove || this.beforeDelete; | ||
config = this.config(config); | ||
config.method = 'DELETE'; | ||
config.url = this.getUrl(config, id); | ||
const beforeFunc = this.beforeRemove || this.beforeDelete; | ||
if (beforeFunc) { | ||
config = beforeFunc(config); | ||
} | ||
if (beforeFunc) { | ||
config = beforeFunc(config); | ||
return this.request(config, this.afterRemove || this.afterDelete); | ||
} | ||
}, { | ||
key: "delete", | ||
value: function _delete() { | ||
return this.remove.apply(this, arguments); | ||
} | ||
}]); | ||
return AvApi; | ||
}(); | ||
return this.request(config, this.afterRemove || this.afterDelete); | ||
} | ||
delete(...args) { | ||
return this.remove(...args); | ||
} | ||
} | ||
exports.default = AvApi; | ||
exports["default"] = AvApi; |
@@ -10,4 +10,4 @@ "use strict"; | ||
enumerable: true, | ||
get: function () { | ||
return _ms.default; | ||
get: function get() { | ||
return _ms["default"]; | ||
} | ||
@@ -17,4 +17,4 @@ }); | ||
enumerable: true, | ||
get: function () { | ||
return _webQL.default; | ||
get: function get() { | ||
return _webQL["default"]; | ||
} | ||
@@ -24,4 +24,4 @@ }); | ||
enumerable: true, | ||
get: function () { | ||
return _logs.default; | ||
get: function get() { | ||
return _logs["default"]; | ||
} | ||
@@ -31,4 +31,4 @@ }); | ||
enumerable: true, | ||
get: function () { | ||
return _dma.default; | ||
get: function get() { | ||
return _dma["default"]; | ||
} | ||
@@ -38,4 +38,4 @@ }); | ||
enumerable: true, | ||
get: function () { | ||
return _navigation.default; | ||
get: function get() { | ||
return _navigation["default"]; | ||
} | ||
@@ -45,4 +45,4 @@ }); | ||
enumerable: true, | ||
get: function () { | ||
return _notifications.default; | ||
get: function get() { | ||
return _notifications["default"]; | ||
} | ||
@@ -52,4 +52,4 @@ }); | ||
enumerable: true, | ||
get: function () { | ||
return _organizations.default; | ||
get: function get() { | ||
return _organizations["default"]; | ||
} | ||
@@ -59,4 +59,4 @@ }); | ||
enumerable: true, | ||
get: function () { | ||
return _permissions.default; | ||
get: function get() { | ||
return _permissions["default"]; | ||
} | ||
@@ -66,4 +66,4 @@ }); | ||
enumerable: true, | ||
get: function () { | ||
return _pdfs.default; | ||
get: function get() { | ||
return _pdfs["default"]; | ||
} | ||
@@ -73,4 +73,4 @@ }); | ||
enumerable: true, | ||
get: function () { | ||
return _providers.default; | ||
get: function get() { | ||
return _providers["default"]; | ||
} | ||
@@ -80,4 +80,4 @@ }); | ||
enumerable: true, | ||
get: function () { | ||
return _proxy.default; | ||
get: function get() { | ||
return _proxy["default"]; | ||
} | ||
@@ -87,4 +87,4 @@ }); | ||
enumerable: true, | ||
get: function () { | ||
return _regions.default; | ||
get: function get() { | ||
return _regions["default"]; | ||
} | ||
@@ -94,4 +94,4 @@ }); | ||
enumerable: true, | ||
get: function () { | ||
return _spaces.default; | ||
get: function get() { | ||
return _spaces["default"]; | ||
} | ||
@@ -101,4 +101,4 @@ }); | ||
enumerable: true, | ||
get: function () { | ||
return _user.default; | ||
get: function get() { | ||
return _user["default"]; | ||
} | ||
@@ -108,4 +108,4 @@ }); | ||
enumerable: true, | ||
get: function () { | ||
return _userPermissions.default; | ||
get: function get() { | ||
return _userPermissions["default"]; | ||
} | ||
@@ -115,4 +115,4 @@ }); | ||
enumerable: true, | ||
get: function () { | ||
return _files.default; | ||
get: function get() { | ||
return _files["default"]; | ||
} | ||
@@ -122,4 +122,4 @@ }); | ||
enumerable: true, | ||
get: function () { | ||
return _filesDelivery.default; | ||
get: function get() { | ||
return _filesDelivery["default"]; | ||
} | ||
@@ -129,4 +129,4 @@ }); | ||
enumerable: true, | ||
get: function () { | ||
return _settings.default; | ||
get: function get() { | ||
return _settings["default"]; | ||
} | ||
@@ -136,4 +136,4 @@ }); | ||
enumerable: true, | ||
get: function () { | ||
return _slotmachine.default; | ||
get: function get() { | ||
return _slotmachine["default"]; | ||
} | ||
@@ -143,4 +143,4 @@ }); | ||
enumerable: true, | ||
get: function () { | ||
return _disclaimers.default; | ||
get: function get() { | ||
return _disclaimers["default"]; | ||
} | ||
@@ -150,7 +150,7 @@ }); | ||
enumerable: true, | ||
get: function () { | ||
return _codes.default; | ||
get: function get() { | ||
return _codes["default"]; | ||
} | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
@@ -201,3 +201,3 @@ var _api = _interopRequireDefault(require("./api")); | ||
var _default = _api.default; | ||
exports.default = _default; | ||
var _default = _api["default"]; | ||
exports["default"] = _default; |
@@ -8,4 +8,12 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper")); | ||
var _api = _interopRequireDefault(require("./api")); | ||
@@ -15,10 +23,16 @@ | ||
class AvMicroservice extends _api.default { | ||
constructor({ | ||
http: http, | ||
promise: promise, | ||
merge: merge, | ||
config: config | ||
}) { | ||
super({ | ||
var AvMicroservice = /*#__PURE__*/function (_AvApi) { | ||
(0, _inherits2["default"])(AvMicroservice, _AvApi); | ||
var _super = (0, _createSuper2["default"])(AvMicroservice); | ||
function AvMicroservice(_ref) { | ||
var _this; | ||
var http = _ref.http, | ||
promise = _ref.promise, | ||
merge = _ref.merge, | ||
config = _ref.config; | ||
(0, _classCallCheck2["default"])(this, AvMicroservice); | ||
_this = _super.call(this, { | ||
http: http, | ||
@@ -29,8 +43,13 @@ promise: promise, | ||
}); | ||
this.defaultConfig = this.merge({}, _options.default.MS, config); | ||
_this.defaultConfig = _this.merge({}, _options["default"].MS, config); | ||
return _this; | ||
} // override aries 1 url concatenation | ||
getUrl(config, id = '') { | ||
const _this$config = this.config(config), | ||
(0, _createClass2["default"])(AvMicroservice, [{ | ||
key: "getUrl", | ||
value: function getUrl(config) { | ||
var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; | ||
var _this$config = this.config(config), | ||
path = _this$config.path, | ||
@@ -41,18 +60,20 @@ version = _this$config.version, | ||
let parts = [path, version || '', name]; | ||
var parts = [path, version || '', name]; | ||
if (id || configId) { | ||
parts = [path, version || '', name, id || configId]; | ||
} | ||
if (id || configId) { | ||
parts = [path, version || '', name, id || configId]; | ||
} | ||
return parts.join('/').replace(/[/]+/g, '/').replace(/\/$/, ''); | ||
} // polling location is the same url | ||
return parts.join('/').replace(/[/]+/g, '/').replace(/\/$/, ''); | ||
} // polling location is the same url | ||
}, { | ||
key: "getLocation", | ||
value: function getLocation(response) { | ||
return this.getUrl(response.config); | ||
} | ||
}]); | ||
return AvMicroservice; | ||
}(_api["default"]); | ||
getLocation(response) { | ||
return this.getUrl(response.config); | ||
} | ||
} | ||
exports.default = AvMicroservice; | ||
exports["default"] = AvMicroservice; |
@@ -6,4 +6,4 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
const API_OPTIONS = { | ||
exports["default"] = void 0; | ||
var API_OPTIONS = { | ||
API: { | ||
@@ -61,2 +61,2 @@ // default base segment for Availity API endpoints | ||
var _default = API_OPTIONS; | ||
exports.default = _default; | ||
exports["default"] = _default; |
@@ -8,24 +8,29 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper")); | ||
var _api = _interopRequireDefault(require("../api")); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
var AvCodes = /*#__PURE__*/function (_AvApi) { | ||
(0, _inherits2["default"])(AvCodes, _AvApi); | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
var _super = (0, _createSuper2["default"])(AvCodes); | ||
class AvCodes extends _api.default { | ||
constructor({ | ||
http: http, | ||
promise: promise, | ||
merge: merge, | ||
config: config | ||
}) { | ||
const options = _objectSpread({ | ||
function AvCodes(_ref) { | ||
var http = _ref.http, | ||
promise = _ref.promise, | ||
merge = _ref.merge, | ||
config = _ref.config; | ||
(0, _classCallCheck2["default"])(this, AvCodes); | ||
var options = (0, _objectSpread2["default"])({ | ||
name: 'codes' | ||
}, config); | ||
super({ | ||
return _super.call(this, { | ||
http: http, | ||
@@ -38,4 +43,5 @@ promise: promise, | ||
} | ||
return AvCodes; | ||
}(_api["default"]); | ||
exports.default = AvCodes; | ||
exports["default"] = AvCodes; |
@@ -8,25 +8,32 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper")); | ||
var _api = _interopRequireDefault(require("../api")); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
var AvDisclaimers = /*#__PURE__*/function (_AvApi) { | ||
(0, _inherits2["default"])(AvDisclaimers, _AvApi); | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
var _super = (0, _createSuper2["default"])(AvDisclaimers); | ||
class AvDisclaimers extends _api.default { | ||
constructor({ | ||
http: http, | ||
promise: promise, | ||
merge: merge, | ||
config: config | ||
}) { | ||
const options = _objectSpread({ | ||
function AvDisclaimers(_ref) { | ||
var http = _ref.http, | ||
promise = _ref.promise, | ||
merge = _ref.merge, | ||
config = _ref.config; | ||
(0, _classCallCheck2["default"])(this, AvDisclaimers); | ||
var options = (0, _objectSpread2["default"])({ | ||
path: '/api/sdk/platform', | ||
name: '/disclaimers' | ||
}, config); | ||
super({ | ||
return _super.call(this, { | ||
http: http, | ||
@@ -39,11 +46,14 @@ promise: promise, | ||
getDisclaimers(id, config) { | ||
const queryConfig = this.addParams({ | ||
id: id | ||
}, config); | ||
return this.query(queryConfig); | ||
} | ||
(0, _createClass2["default"])(AvDisclaimers, [{ | ||
key: "getDisclaimers", | ||
value: function getDisclaimers(id, config) { | ||
var queryConfig = this.addParams({ | ||
id: id | ||
}, config); | ||
return this.query(queryConfig); | ||
} | ||
}]); | ||
return AvDisclaimers; | ||
}(_api["default"]); | ||
} | ||
exports.default = AvDisclaimers; | ||
exports["default"] = AvDisclaimers; |
@@ -8,26 +8,33 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper")); | ||
var _flattenObject = _interopRequireDefault(require("@availity/api-core/lib/flattenObject")); | ||
var _ms = _interopRequireDefault(require("../ms")); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
var DmaLogMessages = /*#__PURE__*/function (_AvMicroservice) { | ||
(0, _inherits2["default"])(DmaLogMessages, _AvMicroservice); | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
var _super = (0, _createSuper2["default"])(DmaLogMessages); | ||
class AvLogMessages extends _ms.default { | ||
constructor({ | ||
http: http, | ||
promise: promise, | ||
merge: merge, | ||
config: config | ||
}) { | ||
const options = _objectSpread({ | ||
path: '/ms/api/availity/internal/dma/log-message-service/portal', | ||
name: 'log-messages', | ||
version: '/v2' | ||
function DmaLogMessages(_ref) { | ||
var http = _ref.http, | ||
promise = _ref.promise, | ||
merge = _ref.merge, | ||
config = _ref.config; | ||
(0, _classCallCheck2["default"])(this, DmaLogMessages); | ||
var options = (0, _objectSpread2["default"])({ | ||
name: 'spc/analytics/log' | ||
}, config); | ||
super({ | ||
return _super.call(this, { | ||
http: http, | ||
@@ -40,8 +47,45 @@ promise: promise, | ||
send(entries) { | ||
return this.create(entries); | ||
} | ||
(0, _createClass2["default"])(DmaLogMessages, [{ | ||
key: "send", | ||
value: function send(level, entries) { | ||
delete entries.level; | ||
var payload = { | ||
level: level, | ||
entries: entries | ||
}; | ||
var flattened = (0, _flattenObject["default"])(payload); | ||
flattened.X_Client_ID = 'smile'; | ||
flattened.X_XSRF_TOKEN = document.cookie.replace(/(?:(?:^|.*;\s*)XSRF-TOKEN\s*=\s*([^;]*).*$)|^.*$/, '$1'); | ||
var fields = Object.keys(flattened).map(function (key) { | ||
var name = key.replace(/\[\d+\]/g, '[]'); | ||
var value = flattened[key]; | ||
return "".concat(name, "=").concat(encodeURIComponent(value)); | ||
}).join('&'); | ||
return fields; | ||
} | ||
}, { | ||
key: "debug", | ||
value: function debug(entries) { | ||
return this.sendBeacon(this.send('debug', entries)); | ||
} | ||
}, { | ||
key: "info", | ||
value: function info(entries) { | ||
return this.sendBeacon(this.send('info', entries)); | ||
} | ||
}, { | ||
key: "warn", | ||
value: function warn(entries) { | ||
return this.sendBeacon(this.send('warn', entries)); | ||
} | ||
}, { | ||
key: "error", | ||
value: function error(entries) { | ||
return this.sendBeacon(this.send('error', entries)); | ||
} | ||
}]); | ||
return DmaLogMessages; | ||
}(_ms["default"]); | ||
} | ||
exports.default = AvLogMessages; | ||
var _default = DmaLogMessages; | ||
exports["default"] = _default; |
@@ -8,20 +8,28 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper")); | ||
var _ms = _interopRequireDefault(require("../ms")); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
var AvFiles = /*#__PURE__*/function (_AvMicroservice) { | ||
(0, _inherits2["default"])(AvFiles, _AvMicroservice); | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
var _super = (0, _createSuper2["default"])(AvFiles); | ||
class AvFiles extends _ms.default { | ||
constructor({ | ||
http: http, | ||
promise: promise, | ||
merge: merge, | ||
config: config | ||
}) { | ||
const options = _objectSpread({ | ||
function AvFiles(_ref) { | ||
var http = _ref.http, | ||
promise = _ref.promise, | ||
merge = _ref.merge, | ||
config = _ref.config; | ||
(0, _classCallCheck2["default"])(this, AvFiles); | ||
var options = (0, _objectSpread2["default"])({ | ||
name: 'core/vault/upload/v1', | ||
@@ -32,4 +40,3 @@ headers: { | ||
}, config); | ||
super({ | ||
return _super.call(this, { | ||
http: http, | ||
@@ -42,15 +49,18 @@ promise: promise, | ||
uploadFile(data, config) { | ||
if (!config.customerId || !config.clientId) { | ||
throw new Error('[config.customerId] and [config.clientId] must be defined'); | ||
(0, _createClass2["default"])(AvFiles, [{ | ||
key: "uploadFile", | ||
value: function uploadFile(data, config) { | ||
if (!config.customerId || !config.clientId) { | ||
throw new Error('[config.customerId] and [config.clientId] must be defined'); | ||
} | ||
config = this.config(config); | ||
config.headers['X-Availity-Customer-ID'] = config.customerId; | ||
config.headers['X-Client-ID'] = config.clientId; | ||
return this.create(data, config); | ||
} | ||
}]); | ||
return AvFiles; | ||
}(_ms["default"]); | ||
config = this.config(config); | ||
config.headers['X-Availity-Customer-ID'] = config.customerId; | ||
config.headers['X-Client-ID'] = config.clientId; | ||
return this.create(data, config); | ||
} | ||
} | ||
exports.default = AvFiles; | ||
exports["default"] = AvFiles; |
@@ -8,20 +8,32 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); | ||
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper")); | ||
var _ms = _interopRequireDefault(require("../ms")); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
var AvFilesDelivery = /*#__PURE__*/function (_AvMicroservice) { | ||
(0, _inherits2["default"])(AvFilesDelivery, _AvMicroservice); | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
var _super = (0, _createSuper2["default"])(AvFilesDelivery); | ||
class AvFilesDelivery extends _ms.default { | ||
constructor({ | ||
http: http, | ||
promise: promise, | ||
merge: merge, | ||
config: config | ||
}) { | ||
const options = _objectSpread({ | ||
function AvFilesDelivery(_ref) { | ||
var http = _ref.http, | ||
promise = _ref.promise, | ||
merge = _ref.merge, | ||
config = _ref.config; | ||
(0, _classCallCheck2["default"])(this, AvFilesDelivery); | ||
var options = (0, _objectSpread2["default"])({ | ||
name: 'platform/file-upload-delivery/v1/batch/deliveries', | ||
@@ -34,4 +46,3 @@ headers: { | ||
}, config); | ||
super({ | ||
return _super.call(this, { | ||
http: http, | ||
@@ -44,20 +55,24 @@ promise: promise, | ||
uploadFilesDelivery(data, config) { | ||
if (!config.customerId || !config.clientId) { | ||
throw new Error('[config.customerId] and [config.clientId] must be defined'); | ||
(0, _createClass2["default"])(AvFilesDelivery, [{ | ||
key: "uploadFilesDelivery", | ||
value: function uploadFilesDelivery(data, config) { | ||
if (!config.customerId || !config.clientId) { | ||
throw new Error('[config.customerId] and [config.clientId] must be defined'); | ||
} | ||
config = this.config(config); | ||
config.headers['X-Availity-Customer-ID'] = config.customerId; | ||
config.headers['X-Client-ID'] = config.clientId; | ||
return this.create(data || {}, config); | ||
} | ||
}, { | ||
key: "getLocation", | ||
value: function getLocation(response) { | ||
var baseUrl = (0, _get2["default"])((0, _getPrototypeOf2["default"])(AvFilesDelivery.prototype), "getLocation", this).call(this, response.config); | ||
return "".concat(baseUrl, "/").concat(response.data.id); | ||
} | ||
}]); | ||
return AvFilesDelivery; | ||
}(_ms["default"]); | ||
config = this.config(config); | ||
config.headers['X-Availity-Customer-ID'] = config.customerId; | ||
config.headers['X-Client-ID'] = config.clientId; | ||
return this.create(data || {}, config); | ||
} | ||
getLocation(response) { | ||
const baseUrl = super.getLocation(response.config); | ||
return `${baseUrl}/${response.data.id}`; | ||
} | ||
} | ||
exports.default = AvFilesDelivery; | ||
exports["default"] = AvFilesDelivery; |
@@ -8,24 +8,33 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper")); | ||
var _api = _interopRequireDefault(require("../api")); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
var _flattenObject = _interopRequireDefault(require("../flattenObject")); | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
var AvLogMessages = /*#__PURE__*/function (_AvApi) { | ||
(0, _inherits2["default"])(AvLogMessages, _AvApi); | ||
class AvLogMessages extends _api.default { | ||
constructor({ | ||
http: http, | ||
promise: promise, | ||
merge: merge, | ||
config: config | ||
}) { | ||
const options = _objectSpread({ | ||
var _super = (0, _createSuper2["default"])(AvLogMessages); | ||
function AvLogMessages(_ref) { | ||
var http = _ref.http, | ||
promise = _ref.promise, | ||
merge = _ref.merge, | ||
config = _ref.config; | ||
(0, _classCallCheck2["default"])(this, AvLogMessages); | ||
var options = (0, _objectSpread2["default"])({ | ||
name: 'log-messages' | ||
}, config); | ||
super({ | ||
return _super.call(this, { | ||
http: http, | ||
@@ -38,28 +47,44 @@ promise: promise, | ||
send(level, entries) { | ||
delete entries.level; | ||
return { | ||
level: level, | ||
entries: entries | ||
}; | ||
} | ||
(0, _createClass2["default"])(AvLogMessages, [{ | ||
key: "send", | ||
value: function send(level, entries) { | ||
delete entries.level; | ||
var payload = { | ||
level: level, | ||
entries: entries | ||
}; | ||
var flattened = (0, _flattenObject["default"])(payload); | ||
flattened.X_Client_ID = this.clientId; | ||
flattened.X_XSRF_TOKEN = document.cookie.replace(/(?:(?:^|.*;\s*)XSRF-TOKEN\s*=\s*([^;]*).*$)|^.*$/, '$1'); | ||
var fields = Object.keys(flattened).map(function (key) { | ||
var name = key.replace(/\[\d+\]/g, '[]'); | ||
var value = flattened[key]; | ||
return "".concat(name, "=").concat(encodeURIComponent(value)); | ||
}).join('&'); | ||
return fields; | ||
} | ||
}, { | ||
key: "debug", | ||
value: function debug(entries) { | ||
return this.sendBeacon(this.send('debug', entries)); | ||
} | ||
}, { | ||
key: "info", | ||
value: function info(entries) { | ||
return this.sendBeacon(this.send('info', entries)); | ||
} | ||
}, { | ||
key: "warn", | ||
value: function warn(entries) { | ||
return this.sendBeacon(this.send('warn', entries)); | ||
} | ||
}, { | ||
key: "error", | ||
value: function error(entries) { | ||
return this.sendBeacon(this.send('error', entries)); | ||
} | ||
}]); | ||
return AvLogMessages; | ||
}(_api["default"]); | ||
debug(entries) { | ||
return this.create(this.send('debug', entries)); | ||
} | ||
info(entries) { | ||
return this.create(this.send('info', entries)); | ||
} | ||
warn(entries) { | ||
return this.create(this.send('warn', entries)); | ||
} | ||
error(entries) { | ||
return this.create(this.send('error', entries)); | ||
} | ||
} | ||
exports.default = AvLogMessages; | ||
exports["default"] = AvLogMessages; |
@@ -8,25 +8,30 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper")); | ||
var _api = _interopRequireDefault(require("../api")); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
var AvNavigation = /*#__PURE__*/function (_AvApi) { | ||
(0, _inherits2["default"])(AvNavigation, _AvApi); | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
var _super = (0, _createSuper2["default"])(AvNavigation); | ||
class AvNavigation extends _api.default { | ||
constructor({ | ||
http: http, | ||
promise: promise, | ||
merge: merge, | ||
config: config | ||
}) { | ||
const options = _objectSpread({ | ||
function AvNavigation(_ref) { | ||
var http = _ref.http, | ||
promise = _ref.promise, | ||
merge = _ref.merge, | ||
config = _ref.config; | ||
(0, _classCallCheck2["default"])(this, AvNavigation); | ||
var options = (0, _objectSpread2["default"])({ | ||
path: 'api/sdk/platform', | ||
name: 'navigation/spaces' | ||
}, config); | ||
super({ | ||
return _super.call(this, { | ||
http: http, | ||
@@ -39,4 +44,5 @@ promise: promise, | ||
} | ||
return AvNavigation; | ||
}(_api["default"]); | ||
exports.default = AvNavigation; | ||
exports["default"] = AvNavigation; |
@@ -8,25 +8,32 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper")); | ||
var _api = _interopRequireDefault(require("../api")); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
var AvNotifications = /*#__PURE__*/function (_AvApi) { | ||
(0, _inherits2["default"])(AvNotifications, _AvApi); | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
var _super = (0, _createSuper2["default"])(AvNotifications); | ||
class AvNotifications extends _api.default { | ||
constructor({ | ||
http: http, | ||
promise: promise, | ||
merge: merge, | ||
config: config | ||
}) { | ||
const options = _objectSpread({ | ||
function AvNotifications(_ref) { | ||
var http = _ref.http, | ||
promise = _ref.promise, | ||
merge = _ref.merge, | ||
config = _ref.config; | ||
(0, _classCallCheck2["default"])(this, AvNotifications); | ||
var options = (0, _objectSpread2["default"])({ | ||
path: 'api', | ||
name: 'notifications' | ||
}, config); | ||
super({ | ||
return _super.call(this, { | ||
http: http, | ||
@@ -39,11 +46,14 @@ promise: promise, | ||
deleteByTopic(topic, config) { | ||
const removeConfig = this.addParams({ | ||
topicId: topic | ||
}, config); | ||
return this.remove(removeConfig); | ||
} | ||
(0, _createClass2["default"])(AvNotifications, [{ | ||
key: "deleteByTopic", | ||
value: function deleteByTopic(topic, config) { | ||
var removeConfig = this.addParams({ | ||
topicId: topic | ||
}, config); | ||
return this.remove(removeConfig); | ||
} | ||
}]); | ||
return AvNotifications; | ||
}(_api["default"]); | ||
} | ||
exports.default = AvNotifications; | ||
exports["default"] = AvNotifications; |
@@ -8,26 +8,46 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator")); | ||
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")); | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); | ||
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper")); | ||
var _qs = _interopRequireDefault(require("qs")); | ||
var _api = _interopRequireDefault(require("../api")); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
var AvOrganizations = /*#__PURE__*/function (_AvApi) { | ||
(0, _inherits2["default"])(AvOrganizations, _AvApi); | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
var _super = (0, _createSuper2["default"])(AvOrganizations); | ||
class AvOrganizations extends _api.default { | ||
constructor({ | ||
http: http, | ||
promise: promise, | ||
merge: merge, | ||
avUsers: avUsers, | ||
config: config | ||
}) { | ||
const options = _objectSpread({ | ||
function AvOrganizations(_ref) { | ||
var _this; | ||
var http = _ref.http, | ||
promise = _ref.promise, | ||
merge = _ref.merge, | ||
avUsers = _ref.avUsers, | ||
avUserPermissions = _ref.avUserPermissions, | ||
config = _ref.config; | ||
(0, _classCallCheck2["default"])(this, AvOrganizations); | ||
var options = (0, _objectSpread2["default"])({ | ||
path: 'api/sdk/platform', | ||
name: 'organizations' | ||
}, config); | ||
super({ | ||
_this = _super.call(this, { | ||
http: http, | ||
@@ -38,26 +58,330 @@ promise: promise, | ||
}); | ||
this.avUsers = avUsers; | ||
} | ||
_this.previousPermissionIds = []; | ||
_this.previousRegionId = ''; | ||
_this.userPermissions = []; | ||
_this.avUsers = avUsers; | ||
_this.avUserPermissions = avUserPermissions; | ||
return _this; | ||
} // Instance variables to help with caching for filtered organizations | ||
queryOrganizations(user, config) { | ||
const queryConfig = this.addParams({ | ||
userId: user.id | ||
}, config); | ||
return this.query(queryConfig); | ||
} | ||
getOrganizations(config) { | ||
if (config && config.params && config.params.userId) { | ||
return this.query(config); | ||
(0, _createClass2["default"])(AvOrganizations, [{ | ||
key: "queryOrganizations", | ||
value: function queryOrganizations(user, config) { | ||
var queryConfig = this.addParams({ | ||
userId: user.id | ||
}, config); | ||
return this.query(queryConfig); | ||
} | ||
}, { | ||
key: "getOrganizations", | ||
value: function getOrganizations(config) { | ||
var _this2 = this; | ||
if (!this.avUsers || !this.avUsers.me) { | ||
throw new Error('avUsers must be defined'); | ||
if (config && config.params && config.params.userId) { | ||
return this.query(config); | ||
} | ||
if (!this.avUsers || !this.avUsers.me) { | ||
throw new Error('avUsers must be defined'); | ||
} | ||
return this.avUsers.me().then(function (user) { | ||
return _this2.queryOrganizations(user, config); | ||
}); | ||
} | ||
}, { | ||
key: "postGet", | ||
value: function () { | ||
var _postGet = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(data, config, additionalPostGetArgs) { | ||
var permissionIds, dataTemp, _yield$_get$call, organizationsData; | ||
return this.avUsers.me().then(user => this.queryOrganizations(user, config)); | ||
} | ||
return _regenerator["default"].wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
if (!additionalPostGetArgs) { | ||
_context.next = 8; | ||
break; | ||
} | ||
} | ||
permissionIds = additionalPostGetArgs.permissionIds; | ||
exports.default = AvOrganizations; | ||
if (permissionIds) { | ||
if (typeof data === 'string') { | ||
dataTemp = _qs["default"].parse(data); | ||
dataTemp.permissionId = permissionIds; | ||
data = _qs["default"].stringify(dataTemp, { | ||
arrayFormat: 'repeat' | ||
}); | ||
} else if (typeof data === 'object') { | ||
data.permissionId = permissionIds; | ||
} | ||
} | ||
_context.next = 5; | ||
return (0, _get2["default"])((0, _getPrototypeOf2["default"])(AvOrganizations.prototype), "postGet", this).call(this, data, config); | ||
case 5: | ||
_yield$_get$call = _context.sent; | ||
organizationsData = _yield$_get$call.data; | ||
return _context.abrupt("return", this.getFilteredOrganizations(organizationsData, additionalPostGetArgs, data)); | ||
case 8: | ||
return _context.abrupt("return", (0, _get2["default"])((0, _getPrototypeOf2["default"])(AvOrganizations.prototype), "postGet", this).call(this, data, config)); | ||
case 9: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
} | ||
}, _callee, this); | ||
})); | ||
function postGet(_x, _x2, _x3) { | ||
return _postGet.apply(this, arguments); | ||
} | ||
return postGet; | ||
}() | ||
}, { | ||
key: "getFilteredOrganizations", | ||
value: function () { | ||
var _getFilteredOrganizations = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(organizationsData, additionalPostGetArgs, data) { | ||
var _this3 = this; | ||
var _additionalPostGetArg, resourceIds, permissionIds, permissionId, region, organizations, orgLimit, orgOffset, totalOrgCount, permissionIdsToUse, resourceIdsToUse, resourceIdsArray, permissionIdsOR, _yield$this$avUserPer, userPermissions, authorizedOrgs, authorizedFilteredOrgs; | ||
return _regenerator["default"].wrap(function _callee2$(_context2) { | ||
while (1) { | ||
switch (_context2.prev = _context2.next) { | ||
case 0: | ||
// for filtered orgs, can pass both permissions and resources in postGetArgs, and we will use the permissionIds here over the data.permissionId | ||
_additionalPostGetArg = additionalPostGetArgs.resourceIds, resourceIds = _additionalPostGetArg === void 0 ? [] : _additionalPostGetArg, permissionIds = additionalPostGetArgs.permissionIds; | ||
permissionId = data.permissionId, region = data.region; | ||
organizations = organizationsData.organizations, orgLimit = organizationsData.limit, orgOffset = organizationsData.offset, totalOrgCount = organizationsData.totalCount; | ||
permissionIdsToUse = permissionIds || permissionId; | ||
permissionIdsToUse = this.sanitizeIds(permissionIdsToUse); | ||
resourceIdsToUse = this.sanitizeIds(resourceIds); // resourceIds is passed as readOnly, convert so that we can use Array methods on it | ||
resourceIdsArray = Array.isArray(resourceIdsToUse) ? resourceIdsToUse : [resourceIdsToUse]; | ||
permissionIdsOR = Array.isArray(permissionIdsToUse) ? permissionIdsToUse : [permissionIdsToUse]; | ||
if (!(region !== this.previousRegionId || !this.arePermissionsEqual(permissionIdsOR))) { | ||
_context2.next = 20; | ||
break; | ||
} | ||
_context2.next = 11; | ||
return this.avUserPermissions.postGet({ | ||
permissionId: permissionIdsOR, | ||
region: region, | ||
limit: permissionIdsOR.length | ||
}); | ||
case 11: | ||
_yield$this$avUserPer = _context2.sent; | ||
userPermissions = _yield$this$avUserPer.data.axiUserPermissions; | ||
if (!userPermissions) { | ||
_context2.next = 19; | ||
break; | ||
} | ||
this.userPermissions = userPermissions.reduce(function (accum, cur) { | ||
accum[cur.id] = cur; | ||
return accum; | ||
}, {}); | ||
this.previousPermissionIds = permissionIdsOR; | ||
this.previousRegionId = region; | ||
_context2.next = 20; | ||
break; | ||
case 19: | ||
throw new Error('avUserPermissions call failed'); | ||
case 20: | ||
// loop thru the permissionId list of ORs, finding and adding matching orgs in the userPermissions. ANDs are beneath/within the ORs | ||
authorizedOrgs = permissionIdsOR.reduce(function (accum, permissionIdOR) { | ||
if (Array.isArray(permissionIdOR)) { | ||
var matchedOrgs = permissionIdOR.reduce(function (matchedANDOrgsByPerm, permissionIdAND, index) { | ||
if (_this3.userPermissions[permissionIdAND]) { | ||
_this3.userPermissions[permissionIdAND].organizations.forEach(function (org) { | ||
if (index === 0) { | ||
// add the orgs for the first permission | ||
matchedANDOrgsByPerm[org.id] = org; | ||
} else if (matchedANDOrgsByPerm[org.id]) { | ||
// if duplicate, add resources | ||
matchedANDOrgsByPerm[org.id].resources = matchedANDOrgsByPerm[org.id].resources.concat(org.resources); | ||
} | ||
}); | ||
} // filter unmatched orgs out | ||
matchedANDOrgsByPerm = Object.keys(matchedANDOrgsByPerm).filter(function (orgId) { | ||
if (_this3.userPermissions[permissionIdAND]) { | ||
return _this3.userPermissions[permissionIdAND].organizations.some(function (org) { | ||
return org.id === orgId; | ||
}); | ||
} | ||
return false; | ||
}).reduce(function (obj, orgId) { | ||
obj[orgId] = matchedANDOrgsByPerm[orgId]; | ||
return obj; | ||
}, {}); | ||
return matchedANDOrgsByPerm; | ||
}, {}); | ||
Object.keys(matchedOrgs).forEach(function (orgId) { | ||
if (!accum[orgId]) { | ||
accum[orgId] = matchedOrgs[orgId]; | ||
accum[orgId].match = false; | ||
} | ||
}); | ||
} else if (_this3.userPermissions[permissionIdOR]) { | ||
_this3.userPermissions[permissionIdOR].organizations.forEach(function (org) { | ||
if (!accum[org.id]) { | ||
accum[org.id] = org; | ||
accum[org.id].match = false; | ||
} else { | ||
// add the resources | ||
accum[org.id].resources = accum[org.id].resources.concat(org.resources); | ||
} | ||
}); | ||
} | ||
return accum; | ||
}, {}); // loop thru the orgs from permission filtering and check resourceIds list to further filter | ||
if (resourceIdsArray.length === 0) { | ||
Object.keys(authorizedOrgs).forEach(function (orgId) { | ||
authorizedOrgs[orgId].match = true; | ||
}); | ||
} else { | ||
resourceIdsArray.forEach(function (resourceIdOR) { | ||
if (Array.isArray(resourceIdOR)) { | ||
// there is AND logic | ||
Object.keys(authorizedOrgs).forEach(function (orgId) { | ||
if (authorizedOrgs[orgId]) { | ||
var isMatch = resourceIdOR.every(function (resId) { | ||
return authorizedOrgs[orgId].resources.some(function (res) { | ||
return res.id === resId; | ||
}); | ||
}); | ||
if (isMatch) { | ||
authorizedOrgs[orgId].match = true; | ||
} | ||
} | ||
}); | ||
} else { | ||
Object.keys(authorizedOrgs).forEach(function (orgId) { | ||
var isMatch = authorizedOrgs[orgId].resources.some(function (res) { | ||
return res.id === resourceIdOR; | ||
}); | ||
if (isMatch || !resourceIdOR) { | ||
authorizedOrgs[orgId].match = true; | ||
} | ||
}); | ||
} | ||
}, {}); | ||
} // avUserPermissions call doesn't return much useful organization data | ||
// but we can match valid ids to useful data returned from avOrganizations | ||
authorizedFilteredOrgs = organizations.filter(function (org) { | ||
return Object.keys(authorizedOrgs).some(function (orgId) { | ||
return authorizedOrgs[orgId] && authorizedOrgs[orgId].match && orgId === org.id; | ||
}); | ||
}); // Transform back into data object that ResourceSelect can use and paginate | ||
return _context2.abrupt("return", { | ||
data: { | ||
authorizedFilteredOrgs: authorizedFilteredOrgs, | ||
totalCount: totalOrgCount, | ||
limit: orgLimit, | ||
offset: orgOffset | ||
} | ||
}); | ||
case 24: | ||
case "end": | ||
return _context2.stop(); | ||
} | ||
} | ||
}, _callee2, this); | ||
})); | ||
function getFilteredOrganizations(_x4, _x5, _x6) { | ||
return _getFilteredOrganizations.apply(this, arguments); | ||
} | ||
return getFilteredOrganizations; | ||
}() | ||
}, { | ||
key: "arePermissionsEqual", | ||
value: function arePermissionsEqual(permissionId) { | ||
// handle nested arrays by collecting all permission values for both new and previous, then Set-ing them | ||
var permissionArray = []; | ||
if (typeof permissionId === 'string' || typeof permissionId === 'number') { | ||
permissionArray.push(permissionId); | ||
} else if (Array.isArray(permissionId)) { | ||
permissionId.forEach(function (permissionOR) { | ||
if (Array.isArray(permissionOR)) { | ||
permissionOR.forEach(function (permissionAND) { | ||
permissionArray.push(permissionAND); | ||
}); | ||
} else { | ||
permissionArray.push(permissionOR); | ||
} | ||
}); | ||
} | ||
var prevPermissionArray = []; | ||
if (typeof this.previousPermissionIds === 'string' || typeof this.previousPermissionIds === 'number') { | ||
prevPermissionArray.push(this.previousPermissionIds); | ||
} else if (Array.isArray(this.previousPermissionIds)) { | ||
this.previousPermissionIds.forEach(function (permissionOR) { | ||
if (Array.isArray(permissionOR)) { | ||
permissionOR.forEach(function (permissionAND) { | ||
prevPermissionArray.push(permissionAND); | ||
}); | ||
} else { | ||
prevPermissionArray.push(permissionOR); | ||
} | ||
}); | ||
} | ||
var idSet = new Set([].concat(permissionArray)); | ||
var idSetCombined = new Set([].concat(permissionArray, prevPermissionArray)); | ||
return idSet.size === idSetCombined.size; | ||
} | ||
}, { | ||
key: "sanitizeIds", | ||
value: function sanitizeIds(unsanitized) { | ||
var _this4 = this; | ||
if (typeof unsanitized === 'string') { | ||
return unsanitized; | ||
} | ||
if (typeof unsanitized === 'number') { | ||
return "".concat(unsanitized); | ||
} | ||
if (Array.isArray(unsanitized)) { | ||
return unsanitized.map(function (dirty) { | ||
return _this4.sanitizeIds(dirty); | ||
}); | ||
} | ||
throw new TypeError('permission/resourcesId(s) must be either an array of ids, a string, or a number'); | ||
} | ||
}]); | ||
return AvOrganizations; | ||
}(_api["default"]); | ||
exports["default"] = AvOrganizations; |
@@ -8,25 +8,32 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper")); | ||
var _api = _interopRequireDefault(require("../api")); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
var AvPdfs = /*#__PURE__*/function (_AvApi) { | ||
(0, _inherits2["default"])(AvPdfs, _AvApi); | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
var _super = (0, _createSuper2["default"])(AvPdfs); | ||
class AvPdfs extends _api.default { | ||
constructor({ | ||
http: http, | ||
promise: promise, | ||
merge: merge, | ||
config: config | ||
}) { | ||
const options = _objectSpread({ | ||
function AvPdfs(_ref) { | ||
var http = _ref.http, | ||
promise = _ref.promise, | ||
merge = _ref.merge, | ||
config = _ref.config; | ||
(0, _classCallCheck2["default"])(this, AvPdfs); | ||
var options = (0, _objectSpread2["default"])({ | ||
path: 'api/utils', | ||
name: 'pdfs' | ||
}, config); | ||
super({ | ||
return _super.call(this, { | ||
http: http, | ||
@@ -39,16 +46,20 @@ promise: promise, | ||
onPdf(response) { | ||
window.location = response.data.pdf.href; | ||
} | ||
(0, _createClass2["default"])(AvPdfs, [{ | ||
key: "onPdf", | ||
value: function onPdf(response) { | ||
window.location = response.data.links.pdf.href; | ||
} | ||
}, { | ||
key: "getPdf", | ||
value: function getPdf(data, config) { | ||
if (!data.applicationId || !data.fileName || !data.html) { | ||
throw new Error('[applicationId], [fileName] and [html] must be defined'); | ||
} | ||
getPdf(data, config) { | ||
if (!data.applicationId || !data.fileName || !data.html) { | ||
throw new Error('[applicationId], [fileName] and [html] must be defined'); | ||
return this.post(data, config).then(this.onPdf); | ||
} | ||
}]); | ||
return AvPdfs; | ||
}(_api["default"]); | ||
return this.post(data, config).then(this.onPdf); | ||
} | ||
} | ||
exports.default = AvPdfs; | ||
exports["default"] = AvPdfs; |
@@ -8,25 +8,32 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper")); | ||
var _api = _interopRequireDefault(require("../api")); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
var AvPermissions = /*#__PURE__*/function (_AvApi) { | ||
(0, _inherits2["default"])(AvPermissions, _AvApi); | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
var _super = (0, _createSuper2["default"])(AvPermissions); | ||
class AvPermissions extends _api.default { | ||
constructor({ | ||
http: http, | ||
promise: promise, | ||
merge: merge, | ||
config: config | ||
}) { | ||
const options = _objectSpread({ | ||
function AvPermissions(_ref) { | ||
var http = _ref.http, | ||
promise = _ref.promise, | ||
merge = _ref.merge, | ||
config = _ref.config; | ||
(0, _classCallCheck2["default"])(this, AvPermissions); | ||
var options = (0, _objectSpread2["default"])({ | ||
path: 'api/sdk/platform', | ||
name: 'permissions' | ||
}, config); | ||
super({ | ||
return _super.call(this, { | ||
http: http, | ||
@@ -39,13 +46,16 @@ promise: promise, | ||
getPermissions(id, region) { | ||
return this.query({ | ||
params: { | ||
id: id, | ||
region: region | ||
} | ||
}); | ||
} | ||
(0, _createClass2["default"])(AvPermissions, [{ | ||
key: "getPermissions", | ||
value: function getPermissions(id, region) { | ||
return this.query({ | ||
params: { | ||
id: id, | ||
region: region | ||
} | ||
}); | ||
} | ||
}]); | ||
return AvPermissions; | ||
}(_api["default"]); | ||
} | ||
exports.default = AvPermissions; | ||
exports["default"] = AvPermissions; |
@@ -8,25 +8,32 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper")); | ||
var _api = _interopRequireDefault(require("../api")); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
var AvProviders = /*#__PURE__*/function (_AvApi) { | ||
(0, _inherits2["default"])(AvProviders, _AvApi); | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
var _super = (0, _createSuper2["default"])(AvProviders); | ||
class AvProviders extends _api.default { | ||
constructor({ | ||
http: http, | ||
promise: promise, | ||
merge: merge, | ||
config: config | ||
}) { | ||
const options = _objectSpread({ | ||
function AvProviders(_ref) { | ||
var http = _ref.http, | ||
promise = _ref.promise, | ||
merge = _ref.merge, | ||
config = _ref.config; | ||
(0, _classCallCheck2["default"])(this, AvProviders); | ||
var options = (0, _objectSpread2["default"])({ | ||
path: 'api/internal', | ||
name: 'providers' | ||
}, config); | ||
super({ | ||
return _super.call(this, { | ||
http: http, | ||
@@ -39,19 +46,23 @@ promise: promise, | ||
getProviders(customerId, config) { | ||
const queryConfig = this.addParams({ | ||
customerId: customerId | ||
}, config); | ||
return this.query(queryConfig); | ||
} | ||
(0, _createClass2["default"])(AvProviders, [{ | ||
key: "getProviders", | ||
value: function getProviders(customerId, config) { | ||
var queryConfig = this.addParams({ | ||
customerId: customerId | ||
}, config); | ||
return this.query(queryConfig); | ||
} | ||
}, { | ||
key: "normalize", | ||
value: function normalize(providers) { | ||
var cloned = providers.slice(); | ||
cloned.forEach(function (provider) { | ||
provider.name = provider.businessName ? provider.businessName : "".concat(provider.lastName, ", ").concat(provider.firstName); | ||
}); | ||
return cloned; | ||
} | ||
}]); | ||
return AvProviders; | ||
}(_api["default"]); | ||
normalize(providers) { | ||
const cloned = providers.slice(); | ||
cloned.forEach(provider => { | ||
provider.name = provider.businessName ? provider.businessName : `${provider.lastName}, ${provider.firstName}`; | ||
}); | ||
return cloned; | ||
} | ||
} | ||
exports.default = AvProviders; | ||
exports["default"] = AvProviders; |
@@ -8,19 +8,26 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper")); | ||
var _api = _interopRequireDefault(require("../api")); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
var AvProxy = /*#__PURE__*/function (_AvApi) { | ||
(0, _inherits2["default"])(AvProxy, _AvApi); | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
var _super = (0, _createSuper2["default"])(AvProxy); | ||
class AvProxy extends _api.default { | ||
constructor({ | ||
http: http, | ||
promise: promise, | ||
merge: merge, | ||
config: config | ||
}) { | ||
function AvProxy(_ref) { | ||
var http = _ref.http, | ||
promise = _ref.promise, | ||
merge = _ref.merge, | ||
config = _ref.config; | ||
(0, _classCallCheck2["default"])(this, AvProxy); | ||
if (!config || !config.tenant) { | ||
@@ -30,8 +37,7 @@ throw new Error('Must specify tenant name for Proxy'); | ||
const options = _objectSpread({ | ||
path: `api/v1/proxy/${config.tenant}`, | ||
var options = (0, _objectSpread2["default"])({ | ||
path: "api/v1/proxy/".concat(config.tenant), | ||
version: '' | ||
}, config); | ||
super({ | ||
return _super.call(this, { | ||
http: http, | ||
@@ -44,4 +50,5 @@ promise: promise, | ||
} | ||
return AvProxy; | ||
}(_api["default"]); | ||
exports.default = AvProxy; | ||
exports["default"] = AvProxy; |
@@ -8,21 +8,31 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper")); | ||
var _api = _interopRequireDefault(require("../api")); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
var AvRegions = /*#__PURE__*/function (_AvApi) { | ||
(0, _inherits2["default"])(AvRegions, _AvApi); | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
var _super = (0, _createSuper2["default"])(AvRegions); | ||
class AvRegions extends _api.default { | ||
constructor({ | ||
http: http, | ||
promise: promise, | ||
merge: merge, | ||
avUsers: avUsers, | ||
config: config | ||
}) { | ||
const options = _objectSpread({ | ||
function AvRegions(_ref) { | ||
var _this; | ||
var http = _ref.http, | ||
promise = _ref.promise, | ||
merge = _ref.merge, | ||
avUsers = _ref.avUsers, | ||
config = _ref.config; | ||
(0, _classCallCheck2["default"])(this, AvRegions); | ||
var options = (0, _objectSpread2["default"])({ | ||
path: 'api/sdk/platform', | ||
@@ -33,4 +43,3 @@ name: 'regions', | ||
}, config); | ||
super({ | ||
_this = _super.call(this, { | ||
http: http, | ||
@@ -41,33 +50,46 @@ promise: promise, | ||
}); | ||
this.avUsers = avUsers; | ||
_this.avUsers = avUsers; | ||
return _this; | ||
} | ||
afterUpdate(response) { | ||
this.setPageBust(); | ||
return response; | ||
} | ||
getRegions(config) { | ||
if (!this.avUsers || !this.avUsers.me) { | ||
throw new Error('avUsers must be defined'); | ||
(0, _createClass2["default"])(AvRegions, [{ | ||
key: "afterUpdate", | ||
value: function afterUpdate(response) { | ||
this.setPageBust(); | ||
return response; | ||
} | ||
}, { | ||
key: "getRegions", | ||
value: function getRegions(config) { | ||
var _this2 = this; | ||
return this.avUsers.me().then(user => { | ||
const queryConfig = this.addParams({ | ||
userId: user.id | ||
}, config); | ||
return this.query(queryConfig); | ||
}); | ||
} | ||
if (config && config.params && config.params.userId) { | ||
return this.query(config); | ||
} | ||
getCurrentRegion() { | ||
return this.query({ | ||
params: { | ||
currentlySelected: true | ||
if (!this.avUsers || !this.avUsers.me) { | ||
throw new Error('avUsers must be defined'); | ||
} | ||
}); | ||
} | ||
} | ||
return this.avUsers.me().then(function (user) { | ||
var queryConfig = _this2.addParams({ | ||
userId: user.id | ||
}, config); | ||
exports.default = AvRegions; | ||
return _this2.query(queryConfig); | ||
}); | ||
} | ||
}, { | ||
key: "getCurrentRegion", | ||
value: function getCurrentRegion() { | ||
return this.query({ | ||
params: { | ||
currentlySelected: true | ||
} | ||
}); | ||
} | ||
}]); | ||
return AvRegions; | ||
}(_api["default"]); | ||
exports["default"] = AvRegions; |
@@ -8,21 +8,31 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper")); | ||
var _api = _interopRequireDefault(require("../api")); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
var AvSettings = /*#__PURE__*/function (_AvApi) { | ||
(0, _inherits2["default"])(AvSettings, _AvApi); | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
var _super = (0, _createSuper2["default"])(AvSettings); | ||
class AvSettings extends _api.default { | ||
constructor({ | ||
http: http, | ||
promise: promise, | ||
merge: merge, | ||
avUsers: avUsers, | ||
config: config | ||
}) { | ||
const options = _objectSpread({ | ||
function AvSettings(_ref) { | ||
var _this; | ||
var http = _ref.http, | ||
promise = _ref.promise, | ||
merge = _ref.merge, | ||
avUsers = _ref.avUsers, | ||
config = _ref.config; | ||
(0, _classCallCheck2["default"])(this, AvSettings); | ||
var options = (0, _objectSpread2["default"])({ | ||
path: 'api/utils', | ||
@@ -33,4 +43,3 @@ name: 'settings', | ||
}, config); | ||
super({ | ||
_this = _super.call(this, { | ||
http: http, | ||
@@ -41,61 +50,71 @@ promise: promise, | ||
}); | ||
this.avUsers = avUsers; | ||
_this.avUsers = avUsers; | ||
return _this; | ||
} | ||
getApplication(applicationId, config) { | ||
if (!applicationId) { | ||
throw new Error('applicationId must be defined'); | ||
} | ||
(0, _createClass2["default"])(AvSettings, [{ | ||
key: "getApplication", | ||
value: function getApplication(applicationId, config) { | ||
var _this2 = this; | ||
if (!this.avUsers || !this.avUsers.me) { | ||
throw new Error('avUsers must be defined'); | ||
} | ||
if (!applicationId) { | ||
throw new Error('applicationId must be defined'); | ||
} | ||
if (config && config.params && config.params.userId) { | ||
const queryConfig = this.addParams({ | ||
applicationId: applicationId | ||
}, config); | ||
return this.query(queryConfig); | ||
} | ||
if (!this.avUsers || !this.avUsers.me) { | ||
throw new Error('avUsers must be defined'); | ||
} | ||
return this.avUsers.me().then(user => { | ||
const queryConfig = this.addParams({ | ||
applicationId: applicationId, | ||
userId: user.id | ||
}, config); | ||
return this.query(queryConfig); | ||
}); | ||
} | ||
if (config && config.params && config.params.userId) { | ||
var queryConfig = this.addParams({ | ||
applicationId: applicationId | ||
}, config); | ||
return this.query(queryConfig); | ||
} | ||
setApplication(applicationId, data, config) { | ||
if (!this.avUsers || !this.avUsers.me) { | ||
throw new Error('avUsers must be defined'); | ||
} | ||
return this.avUsers.me().then(function (user) { | ||
var queryConfig = _this2.addParams({ | ||
applicationId: applicationId, | ||
userId: user.id | ||
}, config); | ||
if (typeof applicationId !== 'string' && typeof applicationId !== 'number') { | ||
config = data; | ||
data = applicationId; | ||
applicationId = ''; | ||
return _this2.query(queryConfig); | ||
}); | ||
} | ||
}, { | ||
key: "setApplication", | ||
value: function setApplication(applicationId, data, config) { | ||
var _this3 = this; | ||
if (!applicationId && (!data || !data.scope || !data.scope.applicationId)) { | ||
throw new Error('applicationId must be defined'); | ||
} | ||
if (!this.avUsers || !this.avUsers.me) { | ||
throw new Error('avUsers must be defined'); | ||
} | ||
if (data && data.scope && data.scope.userId) { | ||
data.scope.applicationId = applicationId; | ||
return this.update(data, config); | ||
} | ||
if (typeof applicationId !== 'string' && typeof applicationId !== 'number') { | ||
config = data; | ||
data = applicationId; | ||
applicationId = ''; | ||
} | ||
return this.avUsers.me().then(user => { | ||
data = data || {}; | ||
data.scope = data.scope || {}; | ||
data.scope.applicationId = applicationId; | ||
data.scope.userId = user.id; | ||
return this.update(data, config); | ||
}); | ||
} | ||
if (!applicationId && (!data || !data.scope || !data.scope.applicationId)) { | ||
throw new Error('applicationId must be defined'); | ||
} | ||
} | ||
if (data && data.scope && data.scope.userId) { | ||
data.scope.applicationId = applicationId; | ||
return this.update(data, config); | ||
} | ||
exports.default = AvSettings; | ||
return this.avUsers.me().then(function (user) { | ||
data = data || {}; | ||
data.scope = data.scope || {}; | ||
data.scope.applicationId = applicationId; | ||
data.scope.userId = user.id; | ||
return _this3.update(data, config); | ||
}); | ||
} | ||
}]); | ||
return AvSettings; | ||
}(_api["default"]); | ||
exports["default"] = AvSettings; |
@@ -8,24 +8,31 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper")); | ||
var _ms = _interopRequireDefault(require("../ms")); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
var AvSlotMachine = /*#__PURE__*/function (_AvMicroservice) { | ||
(0, _inherits2["default"])(AvSlotMachine, _AvMicroservice); | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
var _super = (0, _createSuper2["default"])(AvSlotMachine); | ||
class AvSlotMachine extends _ms.default { | ||
constructor({ | ||
http: http, | ||
promise: promise, | ||
merge: merge, | ||
config: config | ||
}) { | ||
const options = _objectSpread({ | ||
function AvSlotMachine(_ref) { | ||
var http = _ref.http, | ||
promise = _ref.promise, | ||
merge = _ref.merge, | ||
config = _ref.config; | ||
(0, _classCallCheck2["default"])(this, AvSlotMachine); | ||
var options = (0, _objectSpread2["default"])({ | ||
name: 'spc/slotmachine/graphql' | ||
}, config); | ||
super({ | ||
return _super.call(this, { | ||
http: http, | ||
@@ -38,11 +45,14 @@ promise: promise, | ||
query(data, variables) { | ||
return this.create({ | ||
query: data, | ||
variables: variables | ||
}); | ||
} | ||
(0, _createClass2["default"])(AvSlotMachine, [{ | ||
key: "query", | ||
value: function query(data, variables) { | ||
return this.create({ | ||
query: data, | ||
variables: variables | ||
}); | ||
} | ||
}]); | ||
return AvSlotMachine; | ||
}(_ms["default"]); | ||
} | ||
exports.default = AvSlotMachine; | ||
exports["default"] = AvSlotMachine; |
@@ -8,25 +8,32 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper")); | ||
var _api = _interopRequireDefault(require("../api")); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
var AvSpaces = /*#__PURE__*/function (_AvApi) { | ||
(0, _inherits2["default"])(AvSpaces, _AvApi); | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
var _super = (0, _createSuper2["default"])(AvSpaces); | ||
class AvSpaces extends _api.default { | ||
constructor({ | ||
http: http, | ||
promise: promise, | ||
merge: merge, | ||
config: config | ||
}) { | ||
const options = _objectSpread({ | ||
function AvSpaces(_ref) { | ||
var http = _ref.http, | ||
promise = _ref.promise, | ||
merge = _ref.merge, | ||
config = _ref.config; | ||
(0, _classCallCheck2["default"])(this, AvSpaces); | ||
var options = (0, _objectSpread2["default"])({ | ||
path: 'api/sdk/platform', | ||
name: 'spaces' | ||
}, config); | ||
super({ | ||
return _super.call(this, { | ||
http: http, | ||
@@ -39,30 +46,36 @@ promise: promise, | ||
parseSpaceId(query) { | ||
const pairs = query.substr(1).split('&'); | ||
let spaceId = ''; | ||
(0, _createClass2["default"])(AvSpaces, [{ | ||
key: "parseSpaceId", | ||
value: function parseSpaceId(query) { | ||
var pairs = query.substr(1).split('&'); | ||
var spaceId = ''; | ||
if (Array.isArray(pairs)) { | ||
pairs.forEach(item => { | ||
const pair = item.split('='); | ||
const key = pair[0]; | ||
if (Array.isArray(pairs)) { | ||
pairs.forEach(function (item) { | ||
var pair = item.split('='); | ||
var key = pair[0]; | ||
if (key === 'spaceId') { | ||
spaceId = pair[1] && decodeURIComponent(pair[1]); | ||
} | ||
}); | ||
if (key === 'spaceId') { | ||
spaceId = pair[1] && decodeURIComponent(pair[1]); | ||
} | ||
}); | ||
} | ||
return spaceId; | ||
} | ||
}, { | ||
key: "getSpaceName", | ||
value: function getSpaceName(spaceId) { | ||
if (!spaceId) { | ||
throw new Error('[spaceId] must be defined'); | ||
} | ||
return spaceId; | ||
} | ||
getSpaceName(spaceId) { | ||
if (!spaceId) { | ||
throw new Error('[spaceId] must be defined'); | ||
return this.get(spaceId).then(function (response) { | ||
return response.data.name; | ||
}); | ||
} | ||
}]); | ||
return AvSpaces; | ||
}(_api["default"]); | ||
return this.get(spaceId).then(response => response.data.name); | ||
} | ||
} | ||
exports.default = AvSpaces; | ||
exports["default"] = AvSpaces; |
@@ -8,25 +8,32 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper")); | ||
var _api = _interopRequireDefault(require("../api")); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
var AvUsers = /*#__PURE__*/function (_AvApi) { | ||
(0, _inherits2["default"])(AvUsers, _AvApi); | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
var _super = (0, _createSuper2["default"])(AvUsers); | ||
class AvUsers extends _api.default { | ||
constructor({ | ||
http: http, | ||
promise: promise, | ||
merge: merge, | ||
config: config | ||
}) { | ||
const options = _objectSpread({ | ||
function AvUsers(_ref) { | ||
var http = _ref.http, | ||
promise = _ref.promise, | ||
merge = _ref.merge, | ||
config = _ref.config; | ||
(0, _classCallCheck2["default"])(this, AvUsers); | ||
var options = (0, _objectSpread2["default"])({ | ||
path: 'api/sdk/platform', | ||
name: 'users' | ||
}, config); | ||
super({ | ||
return _super.call(this, { | ||
http: http, | ||
@@ -39,8 +46,13 @@ promise: promise, | ||
me(config) { | ||
return this.get('me', config).then(response => response.data); | ||
} | ||
(0, _createClass2["default"])(AvUsers, [{ | ||
key: "me", | ||
value: function me(config) { | ||
return this.get('me', config).then(function (response) { | ||
return response.data; | ||
}); | ||
} | ||
}]); | ||
return AvUsers; | ||
}(_api["default"]); | ||
} | ||
exports.default = AvUsers; | ||
exports["default"] = AvUsers; |
@@ -8,6 +8,14 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper")); | ||
var _qs = _interopRequireDefault(require("qs")); | ||
@@ -17,22 +25,23 @@ | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
var AvUserPermissions = /*#__PURE__*/function (_AvApi) { | ||
(0, _inherits2["default"])(AvUserPermissions, _AvApi); | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
var _super = (0, _createSuper2["default"])(AvUserPermissions); | ||
class AvUserPermissions extends _api.default { | ||
constructor({ | ||
http: http, | ||
promise: promise, | ||
merge: merge, | ||
config: config | ||
}) { | ||
const options = _objectSpread({ | ||
function AvUserPermissions(_ref) { | ||
var http = _ref.http, | ||
promise = _ref.promise, | ||
merge = _ref.merge, | ||
config = _ref.config; | ||
(0, _classCallCheck2["default"])(this, AvUserPermissions); | ||
var options = (0, _objectSpread2["default"])({ | ||
path: 'api/internal', | ||
name: 'axi-user-permissions', | ||
paramsSerializer: params => _qs.default.stringify(params, { | ||
arrayFormat: 'repeat' | ||
}) | ||
paramsSerializer: function paramsSerializer(params) { | ||
return _qs["default"].stringify(params, { | ||
arrayFormat: 'repeat' | ||
}); | ||
} | ||
}, config); | ||
super({ | ||
return _super.call(this, { | ||
http: http, | ||
@@ -45,17 +54,21 @@ promise: promise, | ||
afterQuery(response) { | ||
return response && response.data && response.data.axiUserPermissions ? response.data.axiUserPermissions : []; | ||
} | ||
(0, _createClass2["default"])(AvUserPermissions, [{ | ||
key: "afterQuery", | ||
value: function afterQuery(response) { | ||
return response && response.data && response.data.axiUserPermissions ? response.data.axiUserPermissions : []; | ||
} | ||
}, { | ||
key: "getPermissions", | ||
value: function getPermissions(permissionId, region) { | ||
return this.query({ | ||
params: { | ||
permissionId: permissionId, | ||
region: region | ||
} | ||
}); | ||
} | ||
}]); | ||
return AvUserPermissions; | ||
}(_api["default"]); | ||
getPermissions(permissionId, region) { | ||
return this.query({ | ||
params: { | ||
permissionId: permissionId, | ||
region: region | ||
} | ||
}); | ||
} | ||
} | ||
exports.default = AvUserPermissions; | ||
exports["default"] = AvUserPermissions; |
@@ -8,24 +8,29 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); | ||
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper")); | ||
var _ms = _interopRequireDefault(require("../ms")); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
var AvWebQL = /*#__PURE__*/function (_AvMicroservice) { | ||
(0, _inherits2["default"])(AvWebQL, _AvMicroservice); | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
var _super = (0, _createSuper2["default"])(AvWebQL); | ||
class AvWebQL extends _ms.default { | ||
constructor({ | ||
http: http, | ||
promise: promise, | ||
merge: merge, | ||
config: config | ||
}) { | ||
const options = _objectSpread({ | ||
function AvWebQL(_ref) { | ||
var http = _ref.http, | ||
promise = _ref.promise, | ||
merge = _ref.merge, | ||
config = _ref.config; | ||
(0, _classCallCheck2["default"])(this, AvWebQL); | ||
var options = (0, _objectSpread2["default"])({ | ||
name: 'spc/web/graphql' | ||
}, config); | ||
super({ | ||
return _super.call(this, { | ||
http: http, | ||
@@ -38,4 +43,5 @@ promise: promise, | ||
} | ||
return AvWebQL; | ||
}(_ms["default"]); | ||
exports.default = AvWebQL; | ||
exports["default"] = AvWebQL; |
{ | ||
"name": "@availity/api-core", | ||
"version": "7.0.0-alpha.2+fa3cf31", | ||
"version": "7.0.0-alpha.9+f0d746e", | ||
"description": "Base API definitions for the Availity REST API", | ||
@@ -21,7 +21,6 @@ "keywords": [ | ||
"dependencies": { | ||
"@availity/localstorage-core": "^4.0.0-alpha.19+fa3cf31", | ||
"@availity/resolve-url": "^2.0.0-alpha.19+fa3cf31", | ||
"@availity/resolve-url": "^1.1.19", | ||
"qs": "^6.5.2" | ||
}, | ||
"gitHead": "fa3cf31fb566cea8e0c963f98ee55cba94cf35db" | ||
"gitHead": "f0d746e72dc44112fc306105c9708767644c6372" | ||
} |
# api-core | ||
> Base API definitions for the Availity REST API. | ||
@@ -6,2 +7,16 @@ | ||
## Install | ||
### NPM | ||
```bash | ||
$ npm install @availity/api-core | ||
``` | ||
### Yarn | ||
```bash | ||
$ yarn add @availity/api-core | ||
``` | ||
## [Documentation](https://availity.github.io/sdk-js/api/getting-started) |
@@ -1,2 +0,1 @@ | ||
import * as avLocalStorage from '@availity/localstorage-core'; | ||
import qs from 'qs'; | ||
@@ -36,2 +35,6 @@ import resolveUrl from '@availity/resolve-url'; | ||
getSessionBust() { | ||
return window.localStorage.getItem('avCacheBust'); | ||
} | ||
// set the cache parameters | ||
@@ -56,3 +59,3 @@ cacheParams(config) { | ||
config.sessionBust, | ||
() => avLocalStorage.getSessionBust() || this.getPageBust() | ||
() => this.getSessionBust() || this.getPageBust() | ||
); | ||
@@ -199,2 +202,30 @@ } | ||
sendBeacon(data, config) { | ||
if (!data) { | ||
throw new Error('called method without [data]'); | ||
} | ||
config = this.config(config); | ||
config.method = 'POST'; | ||
config.url = this.getUrl(config); | ||
config.data = data; | ||
const beforeFunc = this.beforeCreate || this.beforePost; | ||
if (beforeFunc) { | ||
config.data = beforeFunc(config.data); | ||
} | ||
if (navigator.sendBeacon) { | ||
const result = navigator.sendBeacon( | ||
config.url, | ||
new Blob([config.data], { | ||
type: 'application/x-www-form-urlencoded', | ||
}) | ||
); | ||
// A truthy return value from navigator.sendBeacon means the browser successfully queued the request | ||
if (result) return this.Promise.resolve(); | ||
} | ||
// Fall back to XHR if browser does not support navigator.sendBeacon or browser fails to queue the request | ||
return this.request(config, this.afterCreate || this.afterPost); | ||
} | ||
post(data, config) { | ||
@@ -265,3 +296,2 @@ return this.create(data, config); | ||
} | ||
/* eslint-disable promise/no-nesting */ | ||
return this.Promise.all( | ||
@@ -316,2 +346,22 @@ otherPages.map(page => | ||
// patch request | ||
patch(id, data, config) { | ||
if (typeof id !== 'string' && typeof id !== 'number') { | ||
config = data; | ||
data = id; | ||
id = ''; | ||
} | ||
config = this.config(config); | ||
config.method = 'PATCH'; | ||
config.url = this.getUrl(config, id); | ||
config.data = data; | ||
const beforeFunc = this.beforePatch; | ||
if (beforeFunc) { | ||
config.data = beforeFunc(config.data); | ||
} | ||
return this.request(config, this.afterPatch); | ||
} | ||
// delete request | ||
@@ -318,0 +368,0 @@ remove(id, config) { |
@@ -0,9 +1,8 @@ | ||
import flattenObject from '@availity/api-core/lib/flattenObject'; | ||
import AvMicroservice from '../ms'; | ||
export default class AvLogMessages extends AvMicroservice { | ||
class DmaLogMessages extends AvMicroservice { | ||
constructor({ http, promise, merge, config }) { | ||
const options = { | ||
path: '/ms/api/availity/internal/dma/log-message-service/portal', | ||
name: 'log-messages', | ||
version: '/v2', | ||
name: 'spc/analytics/log', | ||
...config, | ||
@@ -19,5 +18,41 @@ }; | ||
send(entries) { | ||
return this.create(entries); | ||
send(level, entries) { | ||
delete entries.level; | ||
const payload = { level, entries }; | ||
const flattened = flattenObject(payload); | ||
flattened.X_Client_ID = 'smile'; | ||
flattened.X_XSRF_TOKEN = document.cookie.replace( | ||
/(?:(?:^|.*;\s*)XSRF-TOKEN\s*=\s*([^;]*).*$)|^.*$/, | ||
'$1' | ||
); | ||
const fields = Object.keys(flattened) | ||
.map(key => { | ||
const name = key.replace(/\[\d+\]/g, '[]'); | ||
const value = flattened[key]; | ||
return `${name}=${encodeURIComponent(value)}`; | ||
}) | ||
.join('&'); | ||
return fields; | ||
} | ||
debug(entries) { | ||
return this.sendBeacon(this.send('debug', entries)); | ||
} | ||
info(entries) { | ||
return this.sendBeacon(this.send('info', entries)); | ||
} | ||
warn(entries) { | ||
return this.sendBeacon(this.send('warn', entries)); | ||
} | ||
error(entries) { | ||
return this.sendBeacon(this.send('error', entries)); | ||
} | ||
} | ||
export default DmaLogMessages; |
import AvApi from '../api'; | ||
import flattenObject from '../flattenObject'; | ||
@@ -19,20 +20,37 @@ export default class AvLogMessages extends AvApi { | ||
delete entries.level; | ||
return { level, entries }; | ||
const payload = { level, entries }; | ||
const flattened = flattenObject(payload); | ||
flattened.X_Client_ID = this.clientId; | ||
flattened.X_XSRF_TOKEN = document.cookie.replace( | ||
/(?:(?:^|.*;\s*)XSRF-TOKEN\s*=\s*([^;]*).*$)|^.*$/, | ||
'$1' | ||
); | ||
const fields = Object.keys(flattened) | ||
.map(key => { | ||
const name = key.replace(/\[\d+\]/g, '[]'); | ||
const value = flattened[key]; | ||
return `${name}=${encodeURIComponent(value)}`; | ||
}) | ||
.join('&'); | ||
return fields; | ||
} | ||
debug(entries) { | ||
return this.create(this.send('debug', entries)); | ||
return this.sendBeacon(this.send('debug', entries)); | ||
} | ||
info(entries) { | ||
return this.create(this.send('info', entries)); | ||
return this.sendBeacon(this.send('info', entries)); | ||
} | ||
warn(entries) { | ||
return this.create(this.send('warn', entries)); | ||
return this.sendBeacon(this.send('warn', entries)); | ||
} | ||
error(entries) { | ||
return this.create(this.send('error', entries)); | ||
return this.sendBeacon(this.send('error', entries)); | ||
} | ||
} |
@@ -0,5 +1,6 @@ | ||
import qs from 'qs'; | ||
import AvApi from '../api'; | ||
export default class AvOrganizations extends AvApi { | ||
constructor({ http, promise, merge, avUsers, config }) { | ||
constructor({ http, promise, merge, avUsers, avUserPermissions, config }) { | ||
const options = { | ||
@@ -18,4 +19,12 @@ path: 'api/sdk/platform', | ||
this.avUsers = avUsers; | ||
this.avUserPermissions = avUserPermissions; | ||
} | ||
// Instance variables to help with caching for filtered organizations | ||
previousPermissionIds = []; | ||
previousRegionId = ''; | ||
userPermissions = []; | ||
queryOrganizations(user, config) { | ||
@@ -39,2 +48,256 @@ const queryConfig = this.addParams({ userId: user.id }, config); | ||
} | ||
async postGet(data, config, additionalPostGetArgs) { | ||
if (additionalPostGetArgs) { | ||
const { permissionIds } = additionalPostGetArgs; | ||
if (permissionIds) { | ||
if (typeof data === 'string') { | ||
const dataTemp = qs.parse(data); | ||
dataTemp.permissionId = permissionIds; | ||
data = qs.stringify(dataTemp, { arrayFormat: 'repeat' }); | ||
} else if (typeof data === 'object') { | ||
data.permissionId = permissionIds; | ||
} | ||
} | ||
const { data: organizationsData } = await super.postGet(data, config); | ||
return this.getFilteredOrganizations( | ||
organizationsData, | ||
additionalPostGetArgs, | ||
data | ||
); | ||
} | ||
// Else return normal organizations call | ||
return super.postGet(data, config); | ||
} | ||
async getFilteredOrganizations( | ||
organizationsData, | ||
additionalPostGetArgs, | ||
data | ||
) { | ||
// for filtered orgs, can pass both permissions and resources in postGetArgs, and we will use the permissionIds here over the data.permissionId | ||
const { resourceIds = [], permissionIds } = additionalPostGetArgs; | ||
const { permissionId, region } = data; | ||
const { | ||
organizations, | ||
limit: orgLimit, | ||
offset: orgOffset, | ||
totalCount: totalOrgCount, | ||
} = organizationsData; | ||
let permissionIdsToUse = permissionIds || permissionId; | ||
permissionIdsToUse = this.sanitizeIds(permissionIdsToUse); | ||
const resourceIdsToUse = this.sanitizeIds(resourceIds); | ||
// resourceIds is passed as readOnly, convert so that we can use Array methods on it | ||
const resourceIdsArray = Array.isArray(resourceIdsToUse) | ||
? resourceIdsToUse | ||
: [resourceIdsToUse]; | ||
const permissionIdsOR = Array.isArray(permissionIdsToUse) | ||
? permissionIdsToUse | ||
: [permissionIdsToUse]; | ||
if ( | ||
region !== this.previousRegionId || | ||
!this.arePermissionsEqual(permissionIdsOR) | ||
) { | ||
// avUserPermissions will return a list of user organizations that match given permission and region | ||
// This call does not need to be paginated and | ||
// we should not need to call it every time we paginate orgs if region and permissions are the same | ||
// Limit is set to permissionId.length because that represents maximum results we can get back | ||
const { | ||
data: { axiUserPermissions: userPermissions }, | ||
} = await this.avUserPermissions.postGet({ | ||
permissionId: permissionIdsOR, | ||
region, | ||
limit: permissionIdsOR.length, | ||
}); | ||
if (userPermissions) { | ||
this.userPermissions = userPermissions.reduce((accum, cur) => { | ||
accum[cur.id] = cur; | ||
return accum; | ||
}, {}); | ||
this.previousPermissionIds = permissionIdsOR; | ||
this.previousRegionId = region; | ||
} else { | ||
throw new Error('avUserPermissions call failed'); | ||
} | ||
} | ||
// loop thru the permissionId list of ORs, finding and adding matching orgs in the userPermissions. ANDs are beneath/within the ORs | ||
const authorizedOrgs = permissionIdsOR.reduce((accum, permissionIdOR) => { | ||
if (Array.isArray(permissionIdOR)) { | ||
const matchedOrgs = permissionIdOR.reduce( | ||
(matchedANDOrgsByPerm, permissionIdAND, index) => { | ||
if (this.userPermissions[permissionIdAND]) { | ||
this.userPermissions[permissionIdAND].organizations.forEach( | ||
org => { | ||
if (index === 0) { | ||
// add the orgs for the first permission | ||
matchedANDOrgsByPerm[org.id] = org; | ||
} else if (matchedANDOrgsByPerm[org.id]) { | ||
// if duplicate, add resources | ||
matchedANDOrgsByPerm[ | ||
org.id | ||
].resources = matchedANDOrgsByPerm[org.id].resources.concat( | ||
org.resources | ||
); | ||
} | ||
} | ||
); | ||
} | ||
// filter unmatched orgs out | ||
matchedANDOrgsByPerm = Object.keys(matchedANDOrgsByPerm) | ||
.filter(orgId => { | ||
if (this.userPermissions[permissionIdAND]) { | ||
return this.userPermissions[ | ||
permissionIdAND | ||
].organizations.some(org => org.id === orgId); | ||
} | ||
return false; | ||
}) | ||
.reduce((obj, orgId) => { | ||
obj[orgId] = matchedANDOrgsByPerm[orgId]; | ||
return obj; | ||
}, {}); | ||
return matchedANDOrgsByPerm; | ||
}, | ||
{} | ||
); | ||
Object.keys(matchedOrgs).forEach(orgId => { | ||
if (!accum[orgId]) { | ||
accum[orgId] = matchedOrgs[orgId]; | ||
accum[orgId].match = false; | ||
} | ||
}); | ||
} else if (this.userPermissions[permissionIdOR]) { | ||
this.userPermissions[permissionIdOR].organizations.forEach(org => { | ||
if (!accum[org.id]) { | ||
accum[org.id] = org; | ||
accum[org.id].match = false; | ||
} else { | ||
// add the resources | ||
accum[org.id].resources = accum[org.id].resources.concat( | ||
org.resources | ||
); | ||
} | ||
}); | ||
} | ||
return accum; | ||
}, {}); | ||
// loop thru the orgs from permission filtering and check resourceIds list to further filter | ||
if (resourceIdsArray.length === 0) { | ||
Object.keys(authorizedOrgs).forEach(orgId => { | ||
authorizedOrgs[orgId].match = true; | ||
}); | ||
} else { | ||
resourceIdsArray.forEach(resourceIdOR => { | ||
if (Array.isArray(resourceIdOR)) { | ||
// there is AND logic | ||
Object.keys(authorizedOrgs).forEach(orgId => { | ||
if (authorizedOrgs[orgId]) { | ||
const isMatch = resourceIdOR.every(resId => | ||
authorizedOrgs[orgId].resources.some(res => res.id === resId) | ||
); | ||
if (isMatch) { | ||
authorizedOrgs[orgId].match = true; | ||
} | ||
} | ||
}); | ||
} else { | ||
Object.keys(authorizedOrgs).forEach(orgId => { | ||
const isMatch = authorizedOrgs[orgId].resources.some( | ||
res => res.id === resourceIdOR | ||
); | ||
if (isMatch || !resourceIdOR) { | ||
authorizedOrgs[orgId].match = true; | ||
} | ||
}); | ||
} | ||
}, {}); | ||
} | ||
// avUserPermissions call doesn't return much useful organization data | ||
// but we can match valid ids to useful data returned from avOrganizations | ||
const authorizedFilteredOrgs = organizations.filter(org => | ||
Object.keys(authorizedOrgs).some( | ||
orgId => | ||
authorizedOrgs[orgId] && | ||
authorizedOrgs[orgId].match && | ||
orgId === org.id | ||
) | ||
); | ||
// Transform back into data object that ResourceSelect can use and paginate | ||
return { | ||
data: { | ||
authorizedFilteredOrgs, | ||
totalCount: totalOrgCount, | ||
limit: orgLimit, | ||
offset: orgOffset, | ||
}, | ||
}; | ||
} | ||
arePermissionsEqual(permissionId) { | ||
// handle nested arrays by collecting all permission values for both new and previous, then Set-ing them | ||
const permissionArray = []; | ||
if (typeof permissionId === 'string' || typeof permissionId === 'number') { | ||
permissionArray.push(permissionId); | ||
} else if (Array.isArray(permissionId)) { | ||
permissionId.forEach(permissionOR => { | ||
if (Array.isArray(permissionOR)) { | ||
permissionOR.forEach(permissionAND => { | ||
permissionArray.push(permissionAND); | ||
}); | ||
} else { | ||
permissionArray.push(permissionOR); | ||
} | ||
}); | ||
} | ||
const prevPermissionArray = []; | ||
if ( | ||
typeof this.previousPermissionIds === 'string' || | ||
typeof this.previousPermissionIds === 'number' | ||
) { | ||
prevPermissionArray.push(this.previousPermissionIds); | ||
} else if (Array.isArray(this.previousPermissionIds)) { | ||
this.previousPermissionIds.forEach(permissionOR => { | ||
if (Array.isArray(permissionOR)) { | ||
permissionOR.forEach(permissionAND => { | ||
prevPermissionArray.push(permissionAND); | ||
}); | ||
} else { | ||
prevPermissionArray.push(permissionOR); | ||
} | ||
}); | ||
} | ||
const idSet = new Set([...permissionArray]); | ||
const idSetCombined = new Set([...permissionArray, ...prevPermissionArray]); | ||
return idSet.size === idSetCombined.size; | ||
} | ||
sanitizeIds(unsanitized) { | ||
if (typeof unsanitized === 'string') { | ||
return unsanitized; | ||
} | ||
if (typeof unsanitized === 'number') { | ||
return `${unsanitized}`; | ||
} | ||
if (Array.isArray(unsanitized)) { | ||
return unsanitized.map(dirty => this.sanitizeIds(dirty)); | ||
} | ||
throw new TypeError( | ||
'permission/resourcesId(s) must be either an array of ids, a string, or a number' | ||
); | ||
} | ||
} |
@@ -19,3 +19,3 @@ import AvApi from '../api'; | ||
onPdf(response) { | ||
window.location = response.data.pdf.href; | ||
window.location = response.data.links.pdf.href; | ||
} | ||
@@ -22,0 +22,0 @@ |
@@ -31,2 +31,3 @@ # Availity API's | ||
##### `me()` | ||
Helper function that returns information about logged in user. | ||
@@ -62,3 +63,3 @@ | ||
Service that allows you to get logged=in user's active organizations. | ||
Service that allows you to get logged in user's active organizations. | ||
@@ -75,2 +76,6 @@ #### Methods | ||
##### `postGet(data, config, additionalPostGetArgs)` | ||
Filters the returned organizations by permissions/resources if additionalPostGetArgs are passed | ||
### `AvProviders` | ||
@@ -128,2 +133,3 @@ | ||
### `AvFilesDelivery` | ||
Upload a batch of files to a designated channel configured on the server. | ||
@@ -134,40 +140,28 @@ | ||
#### `uploadFilesDelivery(data, config)` | ||
Method to upload a batch of file deliveries. `data` contains an array of `deliveries`. Provide the `fileUri` (reference field from AvFiles), `deliveryChannel`, and the required `metadata` for that channel. | ||
Example `data`: | ||
```html | ||
data = { | ||
deliveries: | ||
[ { | ||
fileURI: upload.references[0], | ||
deliveryChannel: 'DEMO', | ||
metadata: { payerId: "PAYERID", requestId: "123", patientLastName: "lastName", patientFirstName: "firstName" }, | ||
} ] | ||
}; | ||
data = { deliveries: [ { fileURI: upload.references[0], deliveryChannel: 'DEMO', | ||
metadata: { payerId: "PAYERID", requestId: "123", patientLastName: "lastName", | ||
patientFirstName: "firstName" }, } ] }; | ||
``` | ||
`config` should contain `customerId` and `clientId` | ||
#### Example Response | ||
```html | ||
{ "id": "123456", // batchId | ||
"status": "COMPLETE", // COMPLETE/INPROGRESS | ||
"deliveries": [ | ||
{ | ||
"id": "56789", // deliveryId | ||
"deliveryBatchId": "123456", | ||
"fileURI": <fileUri>, | ||
"deliveryChannel": "DEMO", | ||
"deliveryStatus": "ERRORED", // INPROGRESS/REJECTED/ERRORED/DELIVERED | ||
"errors": [ | ||
{ | ||
"message": "error message", | ||
"subject": "subject of error" | ||
} | ||
], | ||
"metadata": { | ||
payerId: "PAYERID", requestId: "123", patientLastName: "lastName", patientFirstName: "firstName" | ||
} | ||
} | ||
] | ||
} | ||
{ "id": "123456", // batchId "status": "COMPLETE", // COMPLETE/INPROGRESS | ||
"deliveries": [ { "id": "56789", // deliveryId "deliveryBatchId": "123456", | ||
"fileURI": | ||
<fileUri | ||
>, "deliveryChannel": "DEMO", "deliveryStatus": "ERRORED", // | ||
INPROGRESS/REJECTED/ERRORED/DELIVERED "errors": [ { "message": "error | ||
message", "subject": "subject of error" } ], "metadata": { payerId: | ||
"PAYERID", requestId: "123", patientLastName: "lastName", patientFirstName: | ||
"firstName" } } ] }</fileUri | ||
> | ||
``` | ||
@@ -181,3 +175,2 @@ | ||
### `AvSlotMachine` | ||
@@ -184,0 +177,0 @@ |
@@ -27,5 +27,10 @@ import AvApi from '../api'; | ||
getRegions(config) { | ||
if (config && config.params && config.params.userId) { | ||
return this.query(config); | ||
} | ||
if (!this.avUsers || !this.avUsers.me) { | ||
throw new Error('avUsers must be defined'); | ||
} | ||
return this.avUsers.me().then(user => { | ||
@@ -32,0 +37,0 @@ const queryConfig = this.addParams({ userId: user.id }, config); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
2
22
146243
55
3279
+ Added@availity/resolve-url@1.1.25(transitive)
+ Added@babel/runtime@7.25.7(transitive)
+ Addedcore-js@3.38.1(transitive)
+ Addedregenerator-runtime@0.14.1(transitive)
- Removed@availity/localstorage-core@^4.0.0-alpha.19+fa3cf31
- Removed@availity/localstorage-core@4.0.0-alpha.19(transitive)
- Removed@availity/resolve-url@2.0.7(transitive)