├── .adiorc.js ├── .editorconfig ├── .eslintignore ├── .eslintrc.yaml ├── .gitattributes ├── .github ├── CODEOWNERS ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE │ ├── bug.md │ ├── documentation.md │ ├── feature-request.md │ └── question.md ├── PULL_REQUEST_TEMPLATE.md ├── dependabot.yml └── workflows │ ├── codeql-analysis.yml │ ├── commitlint.yml │ ├── deploy.yml │ ├── pr-build.yml │ └── repo-metrics.yml ├── .gitignore ├── .husky ├── .gitignore ├── commit-msg ├── pre-commit └── pre-push ├── .lintstagedrc.js ├── .npmrc ├── .nvmrc ├── .prettierignore ├── .prettierrc.js ├── .yarn ├── plugins │ └── @yarnpkg │ │ └── plugin-interactive-tools.cjs └── releases │ └── yarn-3.2.0.cjs ├── .yarnrc.yml ├── CHANGELOG.md ├── LICENSE ├── README.md ├── codecov.yml ├── commitlint.config.js ├── docusaurus ├── CHANGELOG.md ├── README.md ├── babel.config.js ├── docs │ ├── api │ │ ├── authorizations.md │ │ ├── axios-resources.md │ │ ├── definitions │ │ │ ├── check-validation.png │ │ │ ├── codes.md │ │ │ ├── csv.md │ │ │ ├── files.md │ │ │ ├── logs.md │ │ │ ├── navigation.md │ │ │ ├── notifications.md │ │ │ ├── organizations.md │ │ │ ├── pdfs.md │ │ │ ├── permissions.md │ │ │ ├── providers.md │ │ │ ├── regions.md │ │ │ ├── settings.md │ │ │ ├── spaces.md │ │ │ ├── telemetry.md │ │ │ ├── user-permissions.md │ │ │ └── users.md │ │ ├── downloads.md │ │ ├── getting-started.md │ │ └── uploads.md │ ├── intro.md │ ├── recipes │ │ ├── browser-response.png │ │ ├── http-request.md │ │ └── proxy.md │ └── resources │ │ ├── analytics.md │ │ ├── env-var.md │ │ ├── exceptions.md │ │ ├── messaging.md │ │ ├── native-form.md │ │ ├── relay-id.md │ │ ├── resolve-url.md │ │ └── yup.md ├── docusaurus.config.js ├── package.json ├── project.json ├── sidebars.js ├── src │ └── css │ │ └── custom.css └── static │ ├── .nojekyll │ └── img │ ├── favicon.ico │ └── icon.png ├── jest.config.js ├── jest.polyfills.js ├── jest.preset.js ├── netlify.toml ├── nx.json ├── package.json ├── packages ├── analytics-core │ ├── .npmignore │ ├── CHANGELOG.md │ ├── README.md │ ├── jest.config.js │ ├── package.json │ ├── project.json │ ├── src │ │ ├── analytics.d.ts │ │ ├── analytics.js │ │ ├── dma.d.ts │ │ ├── dma.js │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── plugin.d.ts │ │ ├── plugin.js │ │ ├── splunk.d.ts │ │ ├── splunk.js │ │ ├── telemetry.d.ts │ │ ├── telemetry.js │ │ ├── tests │ │ │ ├── analytics.test.ts │ │ │ ├── dma.test.ts │ │ │ ├── plugin.test.ts │ │ │ ├── splunk.test.ts │ │ │ ├── telemetry.test.ts │ │ │ └── util.test.ts │ │ ├── util.d.ts │ │ └── util.js │ ├── tsconfig.json │ └── tsconfig.spec.json ├── api-axios │ ├── .npmignore │ ├── CHANGELOG.md │ ├── README.md │ ├── READMEv5.md │ ├── jest.config.js │ ├── mocks │ │ ├── handlers.js │ │ └── server.js │ ├── package.json │ ├── project.json │ ├── src │ │ ├── api.js │ │ ├── flatten-object.js │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── ms.js │ │ ├── options.js │ │ ├── proxy.js │ │ ├── resources │ │ │ ├── README.md │ │ │ ├── codes.js │ │ │ ├── disclaimers.js │ │ │ ├── dma.js │ │ │ ├── files.js │ │ │ ├── filesDelivery.js │ │ │ ├── logs.js │ │ │ ├── navigation.js │ │ │ ├── notifications.js │ │ │ ├── organizations.js │ │ │ ├── pdf.js │ │ │ ├── pdfv2.js │ │ │ ├── permissions.js │ │ │ ├── providers.js │ │ │ ├── regions.js │ │ │ ├── routeConfigurations.js │ │ │ ├── settings.js │ │ │ ├── slotmachine.js │ │ │ ├── spaces.js │ │ │ ├── telemetry.js │ │ │ ├── tests │ │ │ │ ├── codes.test.js │ │ │ │ ├── disclaimers.test.js │ │ │ │ ├── dma.test.js │ │ │ │ ├── files.test.js │ │ │ │ ├── filesDelivery.test.js │ │ │ │ ├── logs.test.js │ │ │ │ ├── navigation.test.js │ │ │ │ ├── notifications.test.js │ │ │ │ ├── organizations.test.js │ │ │ │ ├── pdf.test.js │ │ │ │ ├── pdfv2.test.js │ │ │ │ ├── permissions.test.js │ │ │ │ ├── providers.test.js │ │ │ │ ├── regions.test.js │ │ │ │ ├── routeConfigurations.test.js │ │ │ │ ├── settings.test.js │ │ │ │ ├── slotmachine.test.js │ │ │ │ ├── spaces.test.js │ │ │ │ ├── telemetry.test.js │ │ │ │ ├── user.test.js │ │ │ │ ├── userPermissions.test.js │ │ │ │ └── webQL.test.js │ │ │ ├── user.js │ │ │ ├── userPermissions.js │ │ │ └── webQL.js │ │ └── tests │ │ │ ├── api.test.js │ │ │ ├── flattenObject.test.js │ │ │ ├── ms.test.js │ │ │ ├── options.test.js │ │ │ └── proxy.test.js │ ├── tsconfig.json │ └── tsconfig.spec.json ├── api-core │ ├── .npmignore │ ├── CHANGELOG.md │ ├── README.md │ ├── jest.config.js │ ├── package.json │ ├── project.json │ ├── src │ │ ├── api.d.ts │ │ ├── api.js │ │ ├── flattenObject.js │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── ms.d.ts │ │ ├── ms.js │ │ ├── options.js │ │ ├── resolve-host.js │ │ ├── resources │ │ │ ├── README.md │ │ │ ├── codes.js │ │ │ ├── disclaimers.js │ │ │ ├── dma.js │ │ │ ├── files.js │ │ │ ├── filesDelivery.js │ │ │ ├── logs.js │ │ │ ├── navigation.js │ │ │ ├── notifications.js │ │ │ ├── organizations.js │ │ │ ├── pdfs.js │ │ │ ├── permissions.js │ │ │ ├── providers.js │ │ │ ├── proxy.js │ │ │ ├── regions.js │ │ │ ├── settings.js │ │ │ ├── slotmachine.js │ │ │ ├── spaces.js │ │ │ ├── tests │ │ │ │ ├── codes.test.js │ │ │ │ ├── disclaimers.test.js │ │ │ │ ├── dma.test.js │ │ │ │ ├── files.test.js │ │ │ │ ├── filesDelivery.test.js │ │ │ │ ├── logs.test.js │ │ │ │ ├── navigation.test.js │ │ │ │ ├── notifications.test.js │ │ │ │ ├── organizations.test.js │ │ │ │ ├── pdfs.test.js │ │ │ │ ├── permissions.test.js │ │ │ │ ├── providers.test.js │ │ │ │ ├── proxy.test.js │ │ │ │ ├── regions.test.js │ │ │ │ ├── settings.test.js │ │ │ │ ├── slotmachine.test.js │ │ │ │ ├── spaces.test.js │ │ │ │ ├── user.test.js │ │ │ │ ├── userPermissions.test.js │ │ │ │ └── webQL.test.js │ │ │ ├── user.js │ │ │ ├── userPermissions.js │ │ │ └── webQL.js │ │ └── tests │ │ │ ├── api.test.js │ │ │ ├── flattenObject.test.js │ │ │ └── ms.test.js │ ├── tsconfig.json │ └── tsconfig.spec.json ├── authorizations-axios │ ├── .npmignore │ ├── CHANGELOG.md │ ├── README.md │ ├── jest.config.js │ ├── package.json │ ├── project.json │ ├── src │ │ ├── index.d.ts │ │ ├── index.js │ │ └── index.test.js │ ├── tsconfig.json │ └── tsconfig.spec.json ├── authorizations-core │ ├── .npmignore │ ├── CHANGELOG.md │ ├── README.md │ ├── jest.config.js │ ├── package.json │ ├── project.json │ ├── src │ │ ├── index.d.ts │ │ ├── index.js │ │ └── index.test.js │ ├── tsconfig.json │ └── tsconfig.spec.json ├── dl-axios │ ├── .npmignore │ ├── CHANGELOG.md │ ├── README.md │ ├── jest.config.js │ ├── package.json │ ├── project.json │ ├── src │ │ ├── download.js │ │ ├── index.d.ts │ │ └── index.js │ ├── tsconfig.json │ └── tsconfig.spec.json ├── dl-core │ ├── .npmignore │ ├── CHANGELOG.md │ ├── README.md │ ├── jest.config.js │ ├── package.json │ ├── project.json │ ├── src │ │ ├── index.d.ts │ │ ├── index.js │ │ └── index.test.js │ ├── tsconfig.json │ └── tsconfig.spec.json ├── dockyard │ ├── .npmignore │ ├── CHANGELOG.md │ ├── README.md │ ├── jest.config.js │ ├── package.json │ ├── project.json │ ├── src │ │ ├── index.d.ts │ │ ├── index.js │ │ └── index.test.js │ ├── tsconfig.json │ └── tsconfig.spec.json ├── env-var │ ├── .npmignore │ ├── CHANGELOG.md │ ├── README.md │ ├── jest.config.js │ ├── package.json │ ├── project.json │ ├── src │ │ ├── index.d.ts │ │ ├── index.js │ │ └── index.test.js │ ├── tsconfig.json │ └── tsconfig.spec.json ├── exceptions-axios │ ├── .npmignore │ ├── CHANGELOG.md │ ├── README.md │ ├── jest.config.js │ ├── package.json │ ├── project.json │ ├── src │ │ ├── index.d.ts │ │ ├── index.js │ │ └── index.test.js │ ├── tsconfig.json │ └── tsconfig.spec.json ├── exceptions-core │ ├── .npmignore │ ├── CHANGELOG.md │ ├── README.md │ ├── jest.config.js │ ├── package.json │ ├── project.json │ ├── src │ │ ├── index.d.ts │ │ ├── index.js │ │ └── index.test.js │ ├── tsconfig.json │ └── tsconfig.spec.json ├── message-core │ ├── .npmignore │ ├── CHANGELOG.md │ ├── README.md │ ├── jest.config.js │ ├── package.json │ ├── project.json │ ├── src │ │ ├── AvMessage.d.ts │ │ ├── AvMessage.js │ │ ├── AvMessage.test.js │ │ ├── index.d.ts │ │ └── index.js │ ├── tsconfig.json │ └── tsconfig.spec.json ├── native-form │ ├── .npmignore │ ├── CHANGELOG.md │ ├── README.md │ ├── jest.config.js │ ├── package.json │ ├── project.json │ ├── src │ │ ├── flattenObject.js │ │ ├── index.d.ts │ │ ├── index.js │ │ └── tests │ │ │ ├── flattenObject.test.js │ │ │ └── nativeForm.test.js │ ├── tsconfig.json │ └── tsconfig.spec.json ├── relay-id │ ├── .npmignore │ ├── CHANGELOG.md │ ├── README.md │ ├── jest.config.js │ ├── package.json │ ├── project.json │ ├── src │ │ ├── index.d.ts │ │ ├── index.js │ │ └── index.test.js │ ├── tsconfig.json │ └── tsconfig.spec.json ├── resolve-url │ ├── .npmignore │ ├── CHANGELOG.md │ ├── README.md │ ├── jest.config.js │ ├── package.json │ ├── project.json │ ├── src │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── is-absolute-url.d.ts │ │ ├── is-absolute-url.js │ │ ├── relative-to-absolute.d.ts │ │ ├── relative-to-absolute.js │ │ ├── resolve-url.d.ts │ │ ├── resolve-url.js │ │ └── tests │ │ │ ├── is-absolute-url.test.js │ │ │ ├── relative-to-absolute.test.js │ │ │ └── resolve-url.test.js │ ├── tsconfig.json │ └── tsconfig.spec.json ├── upload-core │ ├── .npmignore │ ├── CHANGELOG.md │ ├── README.md │ ├── jest.config.js │ ├── mocks │ │ ├── handlers.ts │ │ ├── server.ts │ │ └── testFile.txt │ ├── package.json │ ├── project.json │ ├── src │ │ ├── http-stack.ts │ │ ├── index.test.ts │ │ ├── index.ts │ │ ├── util.test.ts │ │ └── util.ts │ ├── tsconfig.json │ └── tsconfig.spec.json ├── user-activity-broadcaster │ ├── CHANGELOG.md │ ├── README.md │ ├── jest.config.js │ ├── package.json │ ├── project.json │ ├── src │ │ ├── index.d.ts │ │ ├── index.js │ │ └── tests │ │ │ └── index.test.js │ ├── tsconfig.json │ └── tsconfig.spec.json └── yup │ ├── .npmignore │ ├── CHANGELOG.md │ ├── README.md │ ├── jest.config.js │ ├── package.json │ ├── project.json │ ├── src │ ├── date.ts │ ├── dateRange.ts │ ├── index.ts │ ├── isRequired.ts │ ├── npi.ts │ ├── phone.ts │ └── tests │ │ ├── date.test.ts │ │ ├── dateRange.test.ts │ │ ├── isRequired.test.ts │ │ ├── npi.test.ts │ │ └── phone.test.ts │ ├── tsconfig.json │ └── tsconfig.spec.json ├── plop-templates ├── library │ ├── README.md.hbs │ ├── main.js.hbs │ ├── main.test.js.hbs │ └── package.json.hbs └── resource │ ├── api-axios-ms-resource.js.hbs │ ├── api-axios-resource.js.hbs │ └── api-axios-test.js.hbs ├── plopfile.js ├── scripts ├── artifactory-check.sh └── merge-coverage.js ├── tsconfig.json └── yarn.lock /.adiorc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | packages: ['packages/*'], 3 | ignore: { 4 | src: ['form-data', 'nock', 'xhr-mock', 'ts-jest'], 5 | devDependencies: ['typescript', 'tsup', 'axios', '@types/tus-js-client'], 6 | peerDependencies: ['axios'], 7 | }, 8 | parser: { 9 | plugins: [ 10 | 'typescript', 11 | 'optionalChaining', 12 | 'numericSeparator', 13 | 'classProperties', 14 | 'classPrivateProperties', 15 | 'classPrivateMethods', 16 | ], 17 | }, 18 | }; 19 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | indent_size = 4 15 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | .github 2 | .husky 3 | .vscode 4 | .yarn 5 | 6 | coverage 7 | 8 | /**/.docusaurus 9 | /**/build 10 | /**/dist 11 | /**/lib 12 | /**/node_modules 13 | -------------------------------------------------------------------------------- /.eslintrc.yaml: -------------------------------------------------------------------------------- 1 | extends: availity/browser 2 | rules: 3 | unicorn/no-useless-undefined: 0 4 | unicorn/prefer-string-slice: 0 5 | prefer-arrow-callback: ['error', { allowNamedFunctions: true }] 6 | globals: 7 | Buffer: false 8 | global: false 9 | process: false 10 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | 3 | # Mark binary files to avoid Git showing huge diffs 4 | /.yarn/releases/** binary 5 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-code-owners#example-of-a-codeowners-file 2 | # These owners will be the default owners for everything in the repo. 3 | # Unless a later match takes precedence, 4 | # these users will be requested for review when someone opens a pull request. 5 | # Order is important; the last matching pattern takes the most precedence. 6 | 7 | * @jordan-a-young @LauRoxx @gregmartDOTin @chrishavekost @nylon22 8 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F41B Bug report" 3 | about: Open a new issue here if something isn't working as expected. 4 | --- 5 | 6 | ## 🐛 Bug report 7 | 8 | ### Current Behavior 9 | 10 | 11 | 12 | ### Expected behavior 13 | 14 | 15 | 16 | ### Reproducible example 17 | 18 | 19 | 20 | ### Suggested solution(s) 21 | 22 | 23 | 24 | ### Additional context 25 | 26 | 27 | 28 | ### Your environment 29 | 30 | 31 | 32 | ```bash 33 | npx envinfo --npmPackages '@availity/*' --binaries 34 | ``` 35 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/documentation.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001f4da Documentation" 3 | about: Improvements or suggestions for the docs. 4 | --- 5 | 6 | ## 📖 Documentation 7 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F680Feature request" 3 | about: Suggest an idea or enhancement to our sdk. 4 | --- 5 | 6 | ## 🚀 Feature request 7 | 8 | ### Current Behavior 9 | 10 | 11 | 12 | ### Desired Behavior 13 | 14 | 15 | 16 | ### Suggested Solution 17 | 18 | 19 | 20 | 21 | 22 | ### Who does this impact? Who is this for? 23 | 24 | 25 | 26 | ### Describe alternatives you've considered 27 | 28 | 29 | 30 | ### Additional context 31 | 32 | 33 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: '❓Question' 3 | about: 'Any other issue that is not bug, feature, or docs related.' 4 | --- 5 | 6 | ## ❓Question 7 | 8 | 9 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | **Before submitting a pull request,** please make sure the following is done: 2 | 3 | 1. Fork [the repository](https://github.com/availity/availity-react) and create your branch from `master`. 4 | 2. Run `yarn` in the repository root. 5 | 3. If you've fixed a bug or added code that should be tested, add tests! 6 | 4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch TestName` is helpful in development. 7 | 5. Make sure your code passed the conventional commits check. Read more about [conventional commits](https://www.conventionalcommits.org/en/v1.0.0-beta.4/#summary) 8 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: npm 4 | directory: "/" 5 | schedule: 6 | interval: weekly 7 | time: "10:00" 8 | open-pull-requests-limit: 10 9 | ignore: 10 | - dependency-name: "@babel/preset-env" 11 | versions: 12 | - 7.12.11 13 | -------------------------------------------------------------------------------- /.github/workflows/commitlint.yml: -------------------------------------------------------------------------------- 1 | name: Lint Commit Messages 2 | # Set to pull_request when ready to turn on 3 | on: [never] 4 | 5 | jobs: 6 | commitlint: 7 | if: github.actor != 'dependabot[bot]' 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Checkout Code 11 | uses: actions/checkout@v4 12 | with: 13 | fetch-depth: 0 14 | 15 | - name: Setup Node 16 | uses: actions/setup-node@v4 17 | with: 18 | node-version: 22 19 | cache: "yarn" 20 | cache-dependency-path: "yarn.lock" 21 | 22 | - name: Install Dependencies 23 | run: yarn install --immutable 24 | 25 | - name: Lint Commit Message 26 | uses: wagoid/commitlint-github-action@v5 27 | env: 28 | NODE_PATH: ${{ github.workspace }}/node_modules 29 | with: 30 | configFile: ${{ github.workspace }}/commitlint.config.js 31 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | packages/*/coverage 2 | packages/*/dist 3 | node_modules 4 | *.log 5 | lib 6 | .vscode 7 | .DS_Store 8 | .idea 9 | coverage/ 10 | 11 | /.history 12 | /**/build 13 | /**/.docusaurus 14 | 15 | .yarn/* 16 | !.yarn/patches 17 | !.yarn/releases 18 | !.yarn/plugins 19 | !.yarn/sdks 20 | !.yarn/versions 21 | yarn-error.log 22 | .pnp.* 23 | 24 | .nx/cache 25 | .nx/workspace-data -------------------------------------------------------------------------------- /.husky/.gitignore: -------------------------------------------------------------------------------- 1 | _ 2 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | yarn commitlint -e $1 -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | yarn lint:affected -------------------------------------------------------------------------------- /.husky/pre-push: -------------------------------------------------------------------------------- 1 | yarn lint:affected 2 | yarn test:affected 3 | yarn check:deps 4 | yarn check:registry 5 | -------------------------------------------------------------------------------- /.lintstagedrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | '*.{js,ts}': ['yarn nx affected --target=lint --fix --files', 'prettier --write'], 3 | '*.json': ['prettier --write'], 4 | '*.md': ['prettier --write'], 5 | }; 6 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | package-lock=false 2 | registry="https://registry.npmjs.org/" 3 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | 22 -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # root 2 | .yarn 3 | .husky 4 | .docusaurus/ 5 | coverage/ 6 | plop-templates/ 7 | 8 | # packages 9 | /**/dist 10 | /**/lib 11 | /**/build 12 | **/CHANGELOG.md 13 | 14 | /.nx/cache 15 | /.nx/workspace-data -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | printWidth: 120, 3 | singleQuote: true, 4 | tabWidth: 2, 5 | trailingComma: 'es5', 6 | }; 7 | -------------------------------------------------------------------------------- /.yarnrc.yml: -------------------------------------------------------------------------------- 1 | nodeLinker: node-modules 2 | 3 | npmPublishRegistry: 'https://registry.npmjs.org/' 4 | 5 | npmRegistryServer: 'https://registry.npmjs.org/' 6 | 7 | plugins: 8 | - path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs 9 | spec: '@yarnpkg/plugin-interactive-tools' 10 | 11 | yarnPath: .yarn/releases/yarn-3.2.0.cjs 12 | 13 | supportedArchitectures: 14 | cpu: 15 | - current 16 | - x64 17 | - arm64 18 | libc: 19 | - current 20 | - musl 21 | - glibc 22 | os: 23 | - current 24 | - linux 25 | - darwin 26 | - win32 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016-present Availity, LLC 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | status: 3 | project: 4 | default: on 5 | -------------------------------------------------------------------------------- /commitlint.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['@commitlint/config-conventional', '@commitlint/config-nx-scopes'], 3 | rules: { 4 | 'header-max-length': [0, 'always', 85], 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /docusaurus/README.md: -------------------------------------------------------------------------------- 1 | # Website 2 | 3 | This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator. 4 | 5 | ## Installation 6 | 7 | ```console 8 | yarn install 9 | ``` 10 | 11 | ## Local Development 12 | 13 | ```console 14 | yarn start 15 | ``` 16 | 17 | This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server. 18 | 19 | ## Build 20 | 21 | ```console 22 | yarn build 23 | ``` 24 | 25 | This command generates static content into the `build` directory and can be served using any static contents hosting service. 26 | 27 | ## Deployment 28 | 29 | ```console 30 | GIT_USER= USE_SSH=true yarn deploy 31 | ``` 32 | 33 | If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. 34 | -------------------------------------------------------------------------------- /docusaurus/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [require.resolve('@docusaurus/core/lib/babel/preset')], 3 | }; 4 | -------------------------------------------------------------------------------- /docusaurus/docs/api/definitions/check-validation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Availity/sdk-js/f00663bf84c74a5c957d32fc78111582be045576/docusaurus/docs/api/definitions/check-validation.png -------------------------------------------------------------------------------- /docusaurus/docs/api/definitions/files.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Files 3 | --- 4 | 5 | Files can be uploaded to configured buckets on servers. 6 | 7 | ## POST /ms/api/availity/internal/core/vault/upload/v1/:bucketId 8 | 9 | Upload a file to the specified bucketId 10 | 11 | ### Headers 12 | 13 | - **X-Availity-Customer-ID** _(required)_ - Organization customer id is used by the system to identify the owner of the PDF document. 14 | 15 | ### Parameters 16 | 17 | > The client must send the following `reference` or `filedata` identifying the file. 18 | 19 | - **reference** _(optional)_ — The reference location of a file already uploaded. 20 | - **filedata** _(optional)_ — The file to be uploaded. 21 | 22 | ### Example Request 23 | 24 | ```bash 25 | curl -i -X POST -H 'Content-Type: multipart/form-data' -H 'X-Availity-Customer-Id: 1194' -F reference='bucket://vaultfs/105094/296778f1-4cf8-4d9e-be7e-72772227a958' 'https://apps.availity.com/ms/api/availity/internal/core/vault/upload/v1/myBucketId' 26 | ``` 27 | 28 | ### Example Response 29 | 30 | ```json 31 | [ 32 | { 33 | "files": [ 34 | { 35 | "filename": "myfile.png", 36 | "attachmentName": "filedata", 37 | "url": "/files/105094/296778f1-4cf8-4d9e-be7e-72772227a958", 38 | "mimeType": "image/png", 39 | "size": 12157, 40 | "bucketId": "myBucketId", 41 | "expiration": "2018-12-15T12:43:53.671+0000", 42 | "reference": "bucket://vaultfs/105094/296778f1-4cf8-4d9e-be7e-72772227a958" 43 | } 44 | ] 45 | } 46 | ] 47 | ``` 48 | -------------------------------------------------------------------------------- /docusaurus/docs/api/definitions/logs.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Logs 3 | --- 4 | 5 | Endpoint to log data by level and key/value pairs. 6 | 7 | ## POST /api/v1/log-messages 8 | 9 | ### Body 10 | 11 | - send the entries that you wish to log in key/value pairs 12 | - levels include: INFO, DEBUG, WARN, ERROR 13 | 14 | ### Example Request 15 | 16 | ```bash 17 | curl -i -X POST -H "Content-Type: application/json" -d '{"level": "INFO", "entries": {"user": "userName", "key": "value"}}' 'https://apps.availity.com/api/v1/log-messages' 18 | ``` 19 | 20 | ### Response Code 21 | 22 | A 201 created status code indicates a successful log. No response value is returned. 23 | -------------------------------------------------------------------------------- /docusaurus/docs/api/downloads.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Downloads 3 | --- 4 | 5 | Utility to download files from services 6 | 7 | [![Version](https://img.shields.io/npm/v/@availity/dl-core.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/dl-core) 8 | 9 | ## Install 10 | 11 | ### NPM 12 | 13 | ```bash 14 | npm install @availity/dl-axios @availity/dl-core axios 15 | ``` 16 | 17 | ### Yarn 18 | 19 | ```bash 20 | yarn add @availity/dl-axios @availity/dl-core axios 21 | ``` 22 | 23 | ## Usage 24 | 25 | ```js 26 | const downloadApi = new AvDownloadApi({ 27 | clientId: '1234', 28 | }); 29 | 30 | dowloadApi.getAttachment().then((response) => { 31 | const { data } = response; 32 | downloadApi.downloadAttachment(data, 'filename.csv'); 33 | }); 34 | ``` 35 | 36 | ## Methods 37 | 38 | This class has the following methods to use. 39 | 40 | ### `getAttachment(config)` 41 | 42 | ### `downloadAttachment(data, filename, mime)` 43 | -------------------------------------------------------------------------------- /docusaurus/docs/intro.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Introduction 3 | slug: / 4 | --- 5 | 6 | JavaScript client-side SDK containing different packages for interfacing with Availity's systems. 7 | 8 | ### Supported Browsers 9 | 10 | Packages in this repository are designed to work with the following browsers 11 | 12 | - Google Chrome 13 | - Microsoft Edge 14 | - Mozilla Firefox 15 | 16 | #### Internet Explorer Support 17 | 18 | Active support for Internet Explorer was dropped in August 2021. As of 04/2021 we no longer provide any polyfills. These will need to be configured in your own environment. 19 | 20 | There are 2 options available if you need support for IE 11: 21 | 22 | - Use an older version of the package (you can check the CHANGELOG in the package to see when IE 11 support was dropped for that package) 23 | - You can use [@availity/workflow](https://github.com/Availity/availity-workflow#readme) which will polyfill major features for you. 24 | 25 | 28 | -------------------------------------------------------------------------------- /docusaurus/docs/recipes/browser-response.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Availity/sdk-js/f00663bf84c74a5c957d32fc78111582be045576/docusaurus/docs/recipes/browser-response.png -------------------------------------------------------------------------------- /docusaurus/docs/resources/relay-id.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: relay-id 3 | --- 4 | 5 | Small package containing helpers for encoding/decoding ids according to the relay specification 6 | [![Version](https://img.shields.io/npm/v/@availity/relay-id.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/relay-id) 7 | 8 | ## Installation 9 | 10 | ### NPM 11 | 12 | ```bash 13 | npm install @availity/relay-id 14 | ``` 15 | 16 | ### Yarn 17 | 18 | ```bash 19 | yarn add @availity/relay-id 20 | ``` 21 | 22 | ## Usage 23 | 24 | ```js 25 | import { fromGlobalId, toGlobalId } from '@availity/relay-id'; 26 | 27 | // Will return {type: 'User', id: '789'} 28 | const { type, id } = fromGlobalId('VXNlcjo3ODk='); 29 | 30 | // Will return global id of VXNlcjo3ODk= 31 | const globalId = toGlobalId('User', '789'); 32 | ``` 33 | -------------------------------------------------------------------------------- /docusaurus/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@availity/dinosaurdocs", 3 | "version": "1.2.3", 4 | "private": true, 5 | "installConfig": { 6 | "hoistingLimits": "workspaces" 7 | }, 8 | "scripts": { 9 | "build": "docusaurus build", 10 | "deploy": "docusaurus deploy", 11 | "docusaurus": "docusaurus", 12 | "serve": "docusaurus serve", 13 | "start": "docusaurus start", 14 | "swizzle": "docusaurus swizzle", 15 | "format": "prettier '**/*' --write --ignore-unknown" 16 | }, 17 | "dependencies": { 18 | "@docusaurus/core": "^3.7.0", 19 | "@docusaurus/preset-classic": "^3.7.0", 20 | "@mdx-js/react": "^3.1.0", 21 | "clsx": "^2.1.1", 22 | "react": "^18.3.1", 23 | "react-dom": "^18.3.1" 24 | }, 25 | "browserslist": { 26 | "production": [ 27 | ">0.2%", 28 | "not dead", 29 | "not op_mini all" 30 | ], 31 | "development": [ 32 | "last 1 chrome version", 33 | "last 1 firefox version", 34 | "last 1 safari version" 35 | ] 36 | }, 37 | "prettier": { 38 | "printWidth": 80, 39 | "singleQuote": true, 40 | "trailingComma": "es5", 41 | "tabWidth": 2 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /docusaurus/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@availity/dinosaurdocs", 3 | "$schema": "../node_modules/nx/schemas/project-schema.json", 4 | "projectType": "application", 5 | "targets": { 6 | "version": { 7 | "executor": "@jscutlery/semver:version", 8 | "options": { 9 | "preset": "angular", 10 | "commitMessageFormat": "chore({projectName}): release version ${version} [skip ci]", 11 | "tagPrefix": "{projectName}@", 12 | "baseBranch": "master" 13 | } 14 | }, 15 | "lint": { 16 | "executor": "@nx/eslint:lint", 17 | "options": { 18 | "eslintConfig": ".eslintrc.yaml", 19 | "silent": false, 20 | "fix": false, 21 | "cache": true, 22 | "cacheLocation": "./node_modules/.cache/docusaurus/.eslintcache", 23 | "maxWarnings": -1, 24 | "quiet": false, 25 | "noEslintrc": false, 26 | "hasTypeAwareRules": true, 27 | "cacheStrategy": "metadata" 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /docusaurus/static/.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Availity/sdk-js/f00663bf84c74a5c957d32fc78111582be045576/docusaurus/static/.nojekyll -------------------------------------------------------------------------------- /docusaurus/static/img/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Availity/sdk-js/f00663bf84c74a5c957d32fc78111582be045576/docusaurus/static/img/favicon.ico -------------------------------------------------------------------------------- /docusaurus/static/img/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Availity/sdk-js/f00663bf84c74a5c957d32fc78111582be045576/docusaurus/static/img/icon.png -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | const { pathsToModuleNameMapper } = require('ts-jest'); 2 | 3 | const { compilerOptions } = require('./tsconfig.json'); 4 | 5 | module.exports = { 6 | transform: { 7 | '^.+\\.(ts|js)$': 'ts-jest', 8 | }, 9 | transformIgnorePatterns: ['node_modules/(?!axios|@bundled-es-modules/*)'], 10 | moduleFileExtensions: ['ts', 'js'], 11 | preset: '../../jest.preset.js', 12 | testEnvironment: 'jest-environment-jsdom-global', 13 | globals: { 14 | 'ts-jest': { 15 | tsconfig: '/tsconfig.spec.json', 16 | }, 17 | jsdom: true, 18 | }, 19 | coverageReporters: ['json-summary'], 20 | moduleNameMapper: { 21 | ...pathsToModuleNameMapper(compilerOptions.paths, { prefix: '/../../' }), 22 | }, 23 | setupFiles: ['../../jest.polyfills.js'], 24 | }; 25 | -------------------------------------------------------------------------------- /jest.polyfills.js: -------------------------------------------------------------------------------- 1 | // jest.polyfills.js 2 | /** 3 | * @note The block below contains polyfills for Node.js globals 4 | * required for Jest to function when running JSDOM tests. 5 | * These HAVE to be require's and HAVE to be in this exact 6 | * order, since "undici" depends on the "TextEncoder" global API. 7 | * 8 | * Consider migrating to a more modern test runner if 9 | * you don't want to deal with this. 10 | */ 11 | 12 | const { TextDecoder, TextEncoder } = require('node:util') 13 | 14 | Object.defineProperties(globalThis, { 15 | TextDecoder: { value: TextDecoder }, 16 | TextEncoder: { value: TextEncoder }, 17 | }) 18 | 19 | const { ReadableStream } = require('node:stream/web') 20 | 21 | Object.defineProperties(globalThis, { 22 | ReadableStream: { value: ReadableStream } 23 | }) 24 | 25 | const { Blob, File } = require('node:buffer') 26 | const { fetch, Headers, FormData, Request, Response } = require('undici') 27 | 28 | Object.defineProperties(globalThis, { 29 | fetch: { value: fetch, writable: true }, 30 | Blob: { value: Blob }, 31 | File: { value: File }, 32 | Headers: { value: Headers }, 33 | FormData: { value: FormData }, 34 | Request: { value: Request }, 35 | Response: { value: Response }, 36 | }) 37 | -------------------------------------------------------------------------------- /jest.preset.js: -------------------------------------------------------------------------------- 1 | const nxPreset = require('@nx/jest/preset'); 2 | 3 | module.exports = { ...nxPreset }; 4 | -------------------------------------------------------------------------------- /netlify.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | publish = "docusaurus/build" 3 | command = "yarn build:docs" 4 | 5 | [build.environment] 6 | NODE_VERSION = "14" 7 | -------------------------------------------------------------------------------- /nx.json: -------------------------------------------------------------------------------- 1 | { 2 | "targetDefaults": { 3 | "build": { 4 | "cache": true 5 | }, 6 | "@nx/jest:jest": { 7 | "cache": true, 8 | "inputs": [ 9 | "default", 10 | "^default", 11 | "{workspaceRoot}/jest.preset.js" 12 | ], 13 | "options": { 14 | "passWithNoTests": true 15 | }, 16 | "configurations": { 17 | "ci": { 18 | "ci": true, 19 | "codeCoverage": true 20 | } 21 | } 22 | }, 23 | "@nx/eslint:lint": { 24 | "cache": true, 25 | "inputs": [ 26 | "default", 27 | "{workspaceRoot}/.eslintrc.yaml", 28 | "{workspaceRoot}/tools/eslint-rules/**/*" 29 | ] 30 | } 31 | }, 32 | "extends": "@nx/workspace/presets/npm.json", 33 | "targetDependencies": { 34 | "build": [ 35 | { 36 | "target": "build", 37 | "projects": "dependencies" 38 | } 39 | ], 40 | "prepare": [ 41 | { 42 | "target": "prepare", 43 | "projects": "dependencies" 44 | } 45 | ], 46 | "package": [ 47 | { 48 | "target": "package", 49 | "projects": "dependencies" 50 | } 51 | ] 52 | }, 53 | "pluginsConfig": { 54 | "@nx/js": { 55 | "analyzeSourceFiles": true 56 | } 57 | }, 58 | "useInferencePlugins": false, 59 | "defaultBase": "master" 60 | } 61 | -------------------------------------------------------------------------------- /packages/analytics-core/.npmignore: -------------------------------------------------------------------------------- 1 | **/*.test.js 2 | -------------------------------------------------------------------------------- /packages/analytics-core/README.md: -------------------------------------------------------------------------------- 1 | # @availity/analytics-core 2 | 3 | > analytics package for tracking user behavior on the dom 4 | 5 | [![Version](https://img.shields.io/npm/v/@availity/analytics-core.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/analytics-core) 6 | [![NPM Downloads](https://img.shields.io/npm/dt/@availity/analytics-core.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/analytics-core) 7 | [![Dependecy Status](https://img.shields.io/librariesio/release/npm/@availity/analytics-core?style=for-the-badge)](https://github.com/Availity/sdk-js/blob/master/packages/analytics-core/package.json) 8 | 9 | ## Install 10 | 11 | ### NPM 12 | 13 | ```bash 14 | npm install @availity/analytics-core 15 | ``` 16 | 17 | ### Yarn 18 | 19 | ```bash 20 | yarn add @availity/analytics-core 21 | ``` 22 | 23 | ## Documentation 24 | 25 | Check out more documentation at [availity.github.io](https://availity.github.io/sdk-js/resources/analytics) 26 | -------------------------------------------------------------------------------- /packages/analytics-core/jest.config.js: -------------------------------------------------------------------------------- 1 | const global = require('../../jest.config'); 2 | 3 | module.exports = { 4 | ...global, 5 | displayName: 'analytics-core', 6 | coverageDirectory: '../../coverage/analytics-core', 7 | }; 8 | -------------------------------------------------------------------------------- /packages/analytics-core/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "analytics-core", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "projectType": "library", 5 | "targets": { 6 | "test": { 7 | "executor": "@nx/jest:jest", 8 | "outputs": ["{workspaceRoot}/coverage/analytics-core"], 9 | "options": { 10 | "jestConfig": "packages/analytics-core/jest.config.js" 11 | } 12 | }, 13 | "version": { 14 | "executor": "@jscutlery/semver:version", 15 | "options": { 16 | "preset": "angular", 17 | "commitMessageFormat": "chore({projectName}): release version ${version} [skip ci]", 18 | "tagPrefix": "@availity/{projectName}@", 19 | "baseBranch": "master", 20 | "trackDeps": true 21 | } 22 | }, 23 | "lint": { 24 | "executor": "@nx/eslint:lint", 25 | "options": { 26 | "eslintConfig": ".eslintrc.yaml", 27 | "silent": false, 28 | "fix": false, 29 | "cache": true, 30 | "cacheLocation": "./node_modules/.cache/analytics-core/.eslintcache", 31 | "maxWarnings": -1, 32 | "quiet": false, 33 | "noEslintrc": false, 34 | "hasTypeAwareRules": true, 35 | "cacheStrategy": "metadata" 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/analytics-core/src/analytics.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ 2 | /* eslint-disable @typescript-eslint/no-explicit-any */ 3 | declare class AvAnalytics { 4 | plugins: any[]; 5 | 6 | attributePrefix: string; 7 | 8 | recursive: boolean; 9 | 10 | pageTracking: boolean; 11 | 12 | isPageTracking: boolean; 13 | 14 | hasInit: boolean; 15 | 16 | constructor( 17 | plugins: any | any[], 18 | promise?: PromiseConstructor, 19 | pageTracking?: boolean, 20 | autoTrack?: boolean, 21 | options?: Record 22 | ); 23 | 24 | startAutoTrack(): void; 25 | 26 | stopAutoTrack(): void; 27 | 28 | handleEvent(event: any): void; 29 | 30 | invalidEvent(event: any): boolean; 31 | 32 | getAnalyticAttrs(elem: any): any; 33 | 34 | startPageTracking(): void; 35 | 36 | stopPageTracking(): void; 37 | 38 | init(): void; 39 | 40 | setPageTracking(value?: any): void; 41 | 42 | trackEvent(properties: any): Promise; 43 | 44 | trackPageView(url?: string): Promise; 45 | } 46 | 47 | export default AvAnalytics; 48 | -------------------------------------------------------------------------------- /packages/analytics-core/src/dma.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ 2 | /* eslint-disable @typescript-eslint/no-explicit-any */ 3 | import AvAnalyticsPlugin from './plugin'; 4 | 5 | declare class AvDmaAnalytics extends AvAnalyticsPlugin { 6 | constructor(AvLogMessages: any, enabled?: boolean); 7 | 8 | trackEvent(properties: any): any; 9 | 10 | trackPageView(url: string): any; 11 | } 12 | 13 | export default AvDmaAnalytics; 14 | -------------------------------------------------------------------------------- /packages/analytics-core/src/dma.js: -------------------------------------------------------------------------------- 1 | import * as yup from 'yup'; 2 | import AvAnalyticsPlugin from './plugin'; 3 | 4 | const schema = yup 5 | .object() 6 | .shape({ 7 | level: yup.string().optional(), 8 | applicationId: yup.string().optional(), 9 | payerSpaceId: yup.string().optional(), 10 | label: yup.string().optional(), 11 | appName: yup.string().optional(), 12 | category: yup.string().optional(), 13 | section: yup.string().optional(), 14 | url: yup.string().optional(), 15 | value: yup.string().optional(), 16 | raw: yup.string().optional(), 17 | feed: yup.string().optional(), 18 | feedback: yup.string().optional(), 19 | feedbackName: yup.string().optional(), 20 | additionalFeedback: yup.string().optional(), 21 | smile: yup.string().optional(), 22 | surveyId: yup.string().optional(), 23 | }) 24 | .noUnknown(true); 25 | 26 | export default class AvDmaAnalytics extends AvAnalyticsPlugin { 27 | constructor(AvLogMessages, enabled) { 28 | super(enabled); 29 | this.AvLogMessages = AvLogMessages; 30 | } 31 | 32 | trackEvent(properties) { 33 | properties.level = properties.level || 'info'; 34 | // joi validate the properties 35 | schema.validateSync(properties, { 36 | strict: true, 37 | }); 38 | 39 | return this.AvLogMessages[properties.level](properties); 40 | } 41 | 42 | trackPageView(url) { 43 | return this.trackEvent({ event: 'page', url }); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /packages/analytics-core/src/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default as AvAnalytics } from './analytics'; 2 | export { default as AvAnalyticsPlugin } from './plugin'; 3 | export { default as AvSplunkAnalytics } from './splunk'; 4 | export { default as AvTelemetryAnalytics } from './telemetry'; 5 | export { default as AvDmaAnalytics } from './dma'; 6 | -------------------------------------------------------------------------------- /packages/analytics-core/src/index.js: -------------------------------------------------------------------------------- 1 | export { default as AvAnalytics } from './analytics'; 2 | export { default as AvAnalyticsPlugin } from './plugin'; 3 | export { default as AvSplunkAnalytics } from './splunk'; 4 | export { default as AvTelemetryAnalytics } from './telemetry'; 5 | export { default as AvDmaAnalytics } from './dma'; 6 | -------------------------------------------------------------------------------- /packages/analytics-core/src/plugin.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-explicit-any */ 2 | declare class AvAnalyticsPlugin { 3 | constructor(enabled?: boolean); 4 | 5 | trackEvent(): any; 6 | 7 | trackPageView(): any; 8 | 9 | isEnabled(): boolean; 10 | } 11 | 12 | export default AvAnalyticsPlugin; 13 | -------------------------------------------------------------------------------- /packages/analytics-core/src/plugin.js: -------------------------------------------------------------------------------- 1 | export default class AvAnalyticsPlugin { 2 | constructor(enabled = true) { 3 | this.enabled = !!enabled; 4 | } 5 | 6 | trackEvent() {} 7 | 8 | trackPageView() {} 9 | 10 | isEnabled() { 11 | return this.enabled; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/analytics-core/src/splunk.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ 2 | /* eslint-disable @typescript-eslint/no-explicit-any */ 3 | import AvAnalyticsPlugin from './plugin'; 4 | 5 | declare class AvSplunkAnalytics extends AvAnalyticsPlugin { 6 | constructor(AvLogMessages: any, enabled?: boolean); 7 | 8 | trackEvent(properties: any): any; 9 | 10 | trackPageView(url: string): any; 11 | } 12 | 13 | export default AvSplunkAnalytics; 14 | -------------------------------------------------------------------------------- /packages/analytics-core/src/splunk.js: -------------------------------------------------------------------------------- 1 | import AvAnalyticsPlugin from './plugin'; 2 | 3 | export default class AvSplunkAnalytics extends AvAnalyticsPlugin { 4 | constructor(AvLogMessages, enabled) { 5 | super(enabled); 6 | this.AvLogMessages = AvLogMessages; 7 | } 8 | 9 | trackEvent(properties) { 10 | properties.level = properties.level || 'info'; 11 | return this.AvLogMessages[properties.level](properties); 12 | } 13 | 14 | trackPageView(url) { 15 | return this.trackEvent({ event: 'page', url }); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/analytics-core/src/telemetry.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ 2 | /* eslint-disable @typescript-eslint/no-explicit-any */ 3 | import AvAnalyticsPlugin from './plugin'; 4 | 5 | declare class AvTelemetryAnalytics extends AvAnalyticsPlugin { 6 | constructor( 7 | AvLogMessages: any, 8 | enabled?: boolean, 9 | source_system: string, 10 | contact: string, 11 | owner: string, 12 | sessionId?: string 13 | ); 14 | 15 | trackEvent(properties: any): any; 16 | 17 | trackPageView(url: string): any; 18 | } 19 | 20 | export default AvTelemetryAnalytics; 21 | -------------------------------------------------------------------------------- /packages/analytics-core/src/telemetry.js: -------------------------------------------------------------------------------- 1 | import { v4 as uuidv4 } from 'uuid'; 2 | import AvAnalyticsPlugin from './plugin'; 3 | 4 | export default class AvTelemetryAnalytics extends AvAnalyticsPlugin { 5 | constructor(AvLogMessages, enabled, source_system, contact, owner, sessionId) { 6 | super(enabled); 7 | this.AvLogMessages = AvLogMessages; 8 | 9 | if (!source_system) throw new Error('source_system is required'); 10 | if (!contact) throw new Error('contact is required'); 11 | if (!owner) throw new Error('owner is required'); 12 | 13 | this.source_system = source_system; 14 | this.contact = contact; 15 | this.owner = owner; 16 | this.sessionId = sessionId || uuidv4(); 17 | } 18 | 19 | trackEvent({ customerId, level, payerId, ...properties }) { 20 | const payload = { 21 | customerId, 22 | contact: this.contact, 23 | source_system: this.source_system, 24 | version: 'v1', 25 | sessionId: this.sessionId, 26 | owner: this.owner, 27 | telemetryBody: { 28 | level: level || 'info', 29 | entries: { 30 | ...properties, 31 | }, 32 | }, 33 | }; 34 | 35 | if (payerId) payload.payerId = payerId; 36 | 37 | return this.AvLogMessages[payload.telemetryBody.level](payload); 38 | } 39 | 40 | trackPageView(url) { 41 | return this.trackEvent({ 42 | event: 'page', 43 | action: 'load', 44 | category: this.source_system, 45 | label: 'page-load', 46 | url, 47 | customerId: '0000', 48 | }); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /packages/analytics-core/src/tests/dma.test.ts: -------------------------------------------------------------------------------- 1 | import { avLogMessagesApiV2 } from '@availity/api-axios'; 2 | import { AvDmaAnalytics } from '..'; 3 | 4 | jest.mock('@availity/api-axios'); 5 | 6 | describe('AvSplunkAnalytics', () => { 7 | let mockAvSplunkAnalytics: AvDmaAnalytics; 8 | 9 | beforeEach(() => { 10 | avLogMessagesApiV2.sendBeacon = jest.fn(); 11 | // avLogMessagesApiV2.info = jest.fn; 12 | mockAvSplunkAnalytics = new AvDmaAnalytics(avLogMessagesApiV2); 13 | }); 14 | 15 | test('AvSplunkAnalytics should be defined', () => { 16 | expect(mockAvSplunkAnalytics).toBeDefined(); 17 | }); 18 | 19 | test('trackEvent should call AvLogMessages.send', () => { 20 | const level = 'info'; 21 | mockAvSplunkAnalytics.trackEvent({ level, label: 'test' }); 22 | expect(avLogMessagesApiV2.info).toHaveBeenCalledTimes(1); 23 | }); 24 | 25 | test('trackEvent should not allow unknown keys', () => { 26 | const level = 'info'; 27 | expect(() => { 28 | mockAvSplunkAnalytics.trackEvent({ level, test: 'test' }); 29 | }).toThrow(); 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /packages/analytics-core/src/tests/plugin.test.ts: -------------------------------------------------------------------------------- 1 | import { AvAnalyticsPlugin } from '..'; 2 | 3 | describe('AvAnalyticsPlugin', () => { 4 | let mockPlugin: AvAnalyticsPlugin; 5 | 6 | beforeEach(() => { 7 | mockPlugin = new AvAnalyticsPlugin(); 8 | }); 9 | 10 | test('AvAnalyticsPlugin should be defined', () => { 11 | expect(mockPlugin).toBeDefined(); 12 | }); 13 | 14 | test('should default enabled to true', () => { 15 | expect(mockPlugin.isEnabled()).toBe(true); 16 | mockPlugin = new AvAnalyticsPlugin(false); 17 | expect(mockPlugin.isEnabled()).toBe(false); 18 | }); 19 | 20 | test('isEnabled should return enabled value', () => { 21 | expect(mockPlugin.isEnabled()).toBe(mockPlugin.isEnabled()); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /packages/analytics-core/src/util.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-explicit-any */ 2 | declare const isLeftClickEvent: (event: any) => boolean; 3 | 4 | declare const isModifiedEvent: (event: any) => boolean; 5 | 6 | declare const isValidEventTypeOnTarget: (event: any) => boolean; 7 | 8 | declare const isPluginEnabled: (plugin: any) => any; 9 | 10 | declare const camelCase: (str: any) => any; 11 | 12 | declare const getComposedPath: (node: any) => any; 13 | 14 | export { isLeftClickEvent, isModifiedEvent, isValidEventTypeOnTarget, isPluginEnabled, camelCase, getComposedPath }; 15 | -------------------------------------------------------------------------------- /packages/analytics-core/src/util.js: -------------------------------------------------------------------------------- 1 | export const isLeftClickEvent = (event) => event.button === 0; 2 | 3 | export const isModifiedEvent = (event) => !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey); 4 | 5 | const trackMap = { 6 | select: ['focus', 'blur'], 7 | textarea: ['focus', 'blur'], 8 | input: ['focus', 'blur'], 9 | default: ['click'], 10 | }; 11 | 12 | export const isValidEventTypeOnTarget = (event) => 13 | (trackMap[event.target.nodeName.toLowerCase()] || trackMap.default).indexOf(event.type) > -1; 14 | 15 | export const isPluginEnabled = (plugin) => 16 | typeof plugin.isEnabled === 'function' ? plugin.isEnabled() : plugin.isEnabled; 17 | 18 | export const camelCase = (str) => str.replaceAll(/-([\da-z])/gi, (match, char) => char.toUpperCase()); 19 | 20 | /** 21 | * Polyfill for [`Event.composedPath()`][1]. 22 | * https://gist.github.com/kleinfreund/e9787d73776c0e3750dcfcdc89f100ec 23 | */ 24 | export const getComposedPath = (node) => { 25 | let parent; 26 | if (node.parentNode) { 27 | parent = node.parentNode; 28 | } else if (node.host) { 29 | parent = node.host; 30 | } else if (node.defaultView) { 31 | parent = node.defaultView; 32 | } 33 | 34 | if (parent !== undefined) { 35 | return [node, ...getComposedPath(parent)]; 36 | } 37 | 38 | return [node]; 39 | }; 40 | -------------------------------------------------------------------------------- /packages/analytics-core/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["."], 4 | "exclude": ["dist", "build", "node_modules"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/analytics-core/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"], 7 | "allowJs": true 8 | }, 9 | "include": ["**/*.test.ts", "**/*.d.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /packages/api-axios/.npmignore: -------------------------------------------------------------------------------- 1 | src/**/*test.js 2 | -------------------------------------------------------------------------------- /packages/api-axios/jest.config.js: -------------------------------------------------------------------------------- 1 | const global = require('../../jest.config'); 2 | 3 | module.exports = { 4 | ...global, 5 | testURL: 'http://localhost:8080', 6 | displayName: 'api-axios', 7 | coverageDirectory: '../../coverage/api-axios', 8 | }; 9 | -------------------------------------------------------------------------------- /packages/api-axios/mocks/handlers.js: -------------------------------------------------------------------------------- 1 | import { http, HttpResponse } from 'msw'; 2 | 3 | const handlers = [ 4 | // Handles a POST /login request 5 | http.put('/api/sdk/platform/v1/regions/:region', ({ params }) => { 6 | const { region } = params; 7 | 8 | return HttpResponse.json( 9 | { 10 | links: { 11 | self: { 12 | href: `https://localhost:3000/api/sdk/platform/v1/regions/${region}`, 13 | }, 14 | }, 15 | id: region, 16 | value: region, 17 | currentlySelected: true, 18 | }, 19 | { status: 200 } 20 | ); 21 | }), 22 | 23 | // Handles a GET /user request 24 | http.get('/user', null), 25 | ]; 26 | 27 | export default handlers; 28 | -------------------------------------------------------------------------------- /packages/api-axios/mocks/server.js: -------------------------------------------------------------------------------- 1 | // src/mocks/server.js 2 | import { setupServer } from 'msw/node'; 3 | import handlers from './handlers'; 4 | 5 | // This configures a request mocking server with the given request handlers. 6 | const server = setupServer(...handlers); 7 | 8 | export default server; 9 | -------------------------------------------------------------------------------- /packages/api-axios/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "api-axios", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "projectType": "library", 5 | "targets": { 6 | "test": { 7 | "executor": "@nx/jest:jest", 8 | "outputs": ["{workspaceRoot}/coverage/api-axios"], 9 | "options": { 10 | "jestConfig": "packages/api-axios/jest.config.js" 11 | } 12 | }, 13 | "version": { 14 | "executor": "@jscutlery/semver:version", 15 | "options": { 16 | "preset": "angular", 17 | "commitMessageFormat": "chore({projectName}): release version ${version} [skip ci]", 18 | "tagPrefix": "@availity/{projectName}@", 19 | "baseBranch": "master" 20 | } 21 | }, 22 | "lint": { 23 | "executor": "@nx/eslint:lint", 24 | "options": { 25 | "eslintConfig": ".eslintrc.yaml", 26 | "silent": false, 27 | "fix": false, 28 | "cache": true, 29 | "cacheLocation": "./node_modules/.cache/api-axios/.eslintcache", 30 | "maxWarnings": -1, 31 | "quiet": false, 32 | "noEslintrc": false, 33 | "hasTypeAwareRules": true, 34 | "cacheStrategy": "metadata" 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /packages/api-axios/src/flatten-object.js: -------------------------------------------------------------------------------- 1 | // Copied from https://github.com/Availity/sdk-js/blob/master/packages/native-form/flattenObject.js 2 | export const parseValue = (value) => (value === undefined || value === null ? value : value.toString()); 3 | 4 | const flattenObject = (ob) => 5 | Object.keys(ob).reduce((toReturn, k) => { 6 | if (Object.prototype.toString.call(ob[k]) === '[object Date]') { 7 | toReturn[k] = ob[k].toJSON(); 8 | } else if (ob[k] && typeof ob[k] === 'object') { 9 | const flatObject = flattenObject(ob[k]); 10 | const isArray = Array.isArray(ob[k]); 11 | 12 | for (const k2 of Object.keys(flatObject)) { 13 | toReturn[`${k}${isArray ? k2.replace(/^(\d+)(\..*)?/, '[$1]$2') : `.${k2}`}`] = parseValue(flatObject[k2]); 14 | } 15 | } else { 16 | toReturn[k] = parseValue(ob[k]); 17 | } 18 | 19 | return toReturn; 20 | }, {}); 21 | 22 | export default flattenObject; 23 | -------------------------------------------------------------------------------- /packages/api-axios/src/ms.js: -------------------------------------------------------------------------------- 1 | import merge from 'lodash/merge'; 2 | 3 | import AvApi from './api'; 4 | import API_OPTIONS from './options'; 5 | 6 | export default class AvMicroserviceApi extends AvApi { 7 | constructor(config) { 8 | super(config); 9 | const { http, ...options } = config; 10 | this.defaultConfig = merge({}, API_OPTIONS.MS, options); 11 | } 12 | 13 | getUrl(config, id = '') { 14 | const { path, version, name, id: configId, url } = this.config(config); 15 | 16 | const parts = url ? [url, path, version || '', name] : [path, version || '', name]; 17 | 18 | if (id || configId) { 19 | parts.push(id || configId); 20 | } 21 | 22 | // Filter out empty strings and join with slashes 23 | const newUrl = parts.join('/'); 24 | 25 | if (url) { 26 | // Clean up absolute URLs 27 | return newUrl.replaceAll(/([^:]\/)\/+/g, '$1'); // Remove multiple slashes but preserve https:// 28 | } 29 | // Clean up relative URLs 30 | return newUrl 31 | .replaceAll(/\/+/g, '/') // Replace multiple slashes with single slash 32 | .replace(/^\/+/, '/') // Ensure single leading slash 33 | .replace(/\/+$/, ''); // Remove trailing slash 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /packages/api-axios/src/proxy.js: -------------------------------------------------------------------------------- 1 | import AvApi from './api'; 2 | 3 | export default class AvProxyApi extends AvApi { 4 | constructor(config) { 5 | if (!config?.tenant) { 6 | throw new Error('[config.tenant] must be defined'); 7 | } 8 | 9 | super({ 10 | path: `api/v1/proxy/${config.tenant}`, 11 | version: '', 12 | ...config, 13 | }); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/codes.js: -------------------------------------------------------------------------------- 1 | import AvApi from '../api'; 2 | 3 | export default class AvCodesApi extends AvApi { 4 | constructor(config) { 5 | super({ 6 | name: 'codes', 7 | ...config, 8 | }); 9 | } 10 | } 11 | 12 | export const avCodesApi = new AvCodesApi(); 13 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/disclaimers.js: -------------------------------------------------------------------------------- 1 | import AvApi from '../api'; 2 | 3 | export default class AvDisclaimersApi extends AvApi { 4 | constructor(config) { 5 | super({ 6 | path: '/api/sdk/platform', 7 | name: '/disclaimers', 8 | ...config, 9 | }); 10 | } 11 | 12 | async getDisclaimers(id, config) { 13 | const queryConfig = this.addParams({ id }, config); 14 | return this.query(queryConfig); 15 | } 16 | } 17 | 18 | export const avDisclaimersApi = new AvDisclaimersApi(); 19 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/dma.js: -------------------------------------------------------------------------------- 1 | import flattenObject from '../flatten-object'; 2 | import AvMicroserviceApi from '../ms'; 3 | 4 | export default class AvLogMessagesApiV2 extends AvMicroserviceApi { 5 | constructor(config) { 6 | super({ 7 | name: 'spc/analytics/log', 8 | ...config, 9 | }); 10 | } 11 | 12 | send(level, entries) { 13 | delete entries.level; 14 | const payload = { level, entries }; 15 | const flattened = flattenObject(payload); 16 | 17 | flattened.X_Client_ID = this.clientId; 18 | flattened.X_XSRF_TOKEN = document.cookie.replace(/(?:(?:^|.*;\s*)XSRF-TOKEN\s*=\s*([^;]*).*$)|^.*$/, '$1'); 19 | 20 | const fields = Object.keys(flattened) 21 | .map((key) => { 22 | const name = key.replaceAll(/\[\d+]/g, '[]'); 23 | const value = flattened[key]; 24 | return `${name}=${encodeURIComponent(value)}`; 25 | }) 26 | .join('&'); 27 | 28 | return fields; 29 | } 30 | 31 | async debug(entries) { 32 | return this.sendBeacon(this.send('debug', entries)); 33 | } 34 | 35 | async info(entries) { 36 | return this.sendBeacon(this.send('info', entries)); 37 | } 38 | 39 | async warn(entries) { 40 | return this.sendBeacon(this.send('warn', entries)); 41 | } 42 | 43 | async error(entries) { 44 | return this.sendBeacon(this.send('error', entries)); 45 | } 46 | } 47 | 48 | export const avLogMessagesApiV2 = new AvLogMessagesApiV2(); 49 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/files.js: -------------------------------------------------------------------------------- 1 | import AvMicroserviceApi from '../ms'; 2 | 3 | export default class AvFilesApi extends AvMicroserviceApi { 4 | constructor(config) { 5 | super({ 6 | name: 'core/vault/upload/v1', 7 | headers: { 8 | 'Content-Type': undefined, 9 | }, 10 | ...config, 11 | }); 12 | } 13 | 14 | async uploadFile(data, config) { 15 | if (!config.customerId || !config.clientId) { 16 | throw new Error('[config.customerId] and [config.clientId] must be defined'); 17 | } 18 | 19 | config = this.config(config); 20 | config.headers['X-Availity-Customer-ID'] = config.customerId; 21 | config.headers['X-Client-ID'] = config.clientId; 22 | 23 | return this.create(data, config); 24 | } 25 | } 26 | 27 | export const avFilesApi = new AvFilesApi(); 28 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/filesDelivery.js: -------------------------------------------------------------------------------- 1 | import AvMicroserviceApi from '../ms'; 2 | 3 | export default class AvFilesDeliveryApi extends AvMicroserviceApi { 4 | constructor(config) { 5 | super({ 6 | name: 'platform/file-upload-delivery/v1/batch/deliveries', 7 | headers: { 8 | 'Content-Type': 'application/json', 9 | }, 10 | polling: true, 11 | pollingMethod: 'GET', 12 | ...config, 13 | }); 14 | } 15 | 16 | async uploadFilesDelivery(data, config) { 17 | if (!config.customerId || !config.clientId) { 18 | throw new Error('[config.customerId] and [config.clientId] must be defined'); 19 | } 20 | config = this.config(config); 21 | config.headers['X-Availity-Customer-ID'] = config.customerId; 22 | config.headers['X-Client-ID'] = config.clientId; 23 | 24 | return this.create(data || {}, config); 25 | } 26 | 27 | getLocation(response) { 28 | const baseUrl = super.getLocation(response); 29 | const { id } = response.data; 30 | return !id || baseUrl.endsWith(id) ? `${baseUrl}` : `${baseUrl}/${id}`; 31 | } 32 | } 33 | 34 | export const avFilesDeliveryApi = new AvFilesDeliveryApi(); 35 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/logs.js: -------------------------------------------------------------------------------- 1 | import AvApi from '../api'; 2 | import flattenObject from '../flatten-object'; 3 | 4 | export default class AvLogMessagesApi extends AvApi { 5 | constructor(config) { 6 | super({ 7 | name: 'log-messages', 8 | ...config, 9 | }); 10 | } 11 | 12 | send(level, entries) { 13 | delete entries.level; 14 | const payload = { level, entries }; 15 | const flattened = flattenObject(payload); 16 | 17 | flattened.X_Client_ID = this.clientId; 18 | flattened.X_XSRF_TOKEN = document.cookie.replace(/(?:(?:^|.*;\s*)XSRF-TOKEN\s*=\s*([^;]*).*$)|^.*$/, '$1'); 19 | 20 | const fields = Object.keys(flattened) 21 | .map((key) => { 22 | const name = key.replaceAll(/\[\d+]/g, '[]'); 23 | const value = flattened[key]; 24 | return `${name}=${encodeURIComponent(value)}`; 25 | }) 26 | .join('&'); 27 | 28 | return fields; 29 | } 30 | 31 | async debug(entries) { 32 | return this.sendBeacon(this.send('debug', entries)); 33 | } 34 | 35 | async info(entries) { 36 | return this.sendBeacon(this.send('info', entries)); 37 | } 38 | 39 | async warn(entries) { 40 | return this.sendBeacon(this.send('warn', entries)); 41 | } 42 | 43 | async error(entries) { 44 | return this.sendBeacon(this.send('error', entries)); 45 | } 46 | } 47 | 48 | export const avLogMessagesApi = new AvLogMessagesApi(); 49 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/navigation.js: -------------------------------------------------------------------------------- 1 | import AvApi from '../api'; 2 | 3 | export default class AvNavigationApi extends AvApi { 4 | constructor(config) { 5 | super({ 6 | path: 'api/sdk/platform', 7 | name: 'navigation/spaces', 8 | ...config, 9 | }); 10 | } 11 | } 12 | 13 | export const avNavigationApi = new AvNavigationApi(); 14 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/notifications.js: -------------------------------------------------------------------------------- 1 | import AvApi from '../api'; 2 | 3 | export default class AvNotificationsApi extends AvApi { 4 | constructor(config) { 5 | super({ 6 | path: 'api', 7 | name: 'notifications', 8 | ...config, 9 | }); 10 | } 11 | 12 | async deleteByTopic(topic, config) { 13 | const removeConfig = this.addParams({ topicId: topic }, config); 14 | return this.remove(removeConfig); 15 | } 16 | } 17 | 18 | export const avNotificationsApi = new AvNotificationsApi(); 19 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/pdf.js: -------------------------------------------------------------------------------- 1 | import AvApi from '../api'; 2 | 3 | export default class AvPdfApi extends AvApi { 4 | constructor(config) { 5 | super({ 6 | path: 'api/utils', 7 | name: 'pdfs', 8 | ...config, 9 | }); 10 | } 11 | 12 | onPdf(response) { 13 | window.location = response.data.links.pdf.href; 14 | } 15 | 16 | async getPdf(data, config) { 17 | if (!data.applicationId || !data.fileName || !data.html) { 18 | throw new Error('[applicationId], [fileName] and [html] must be defined'); 19 | } 20 | 21 | const response = await this.post(data, config); 22 | this.onPdf(response); 23 | 24 | return response; 25 | } 26 | } 27 | 28 | export const avPdfApi = new AvPdfApi(); 29 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/pdfv2.js: -------------------------------------------------------------------------------- 1 | import AvMicroserviceApi from '../ms'; 2 | 3 | export default class AvPdfMicroserviceApi extends AvMicroserviceApi { 4 | constructor(config) { 5 | super({ 6 | ...config, 7 | name: 'spc/pdf/', 8 | }); 9 | } 10 | 11 | getUrl(config, id = '') { 12 | const { path, version, name, id: configId } = this.config(config); 13 | let parts = [path, version || '', name]; 14 | 15 | if (id || configId) { 16 | parts = [path, version || '', name, id || configId]; 17 | } 18 | 19 | return parts.join('/').replaceAll(/\/+/g, '/'); 20 | } 21 | } 22 | 23 | export const avPdfMicroserviceApi = new AvPdfMicroserviceApi(); 24 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/permissions.js: -------------------------------------------------------------------------------- 1 | import AvApi from '../api'; 2 | 3 | export default class AvPermissionsApi extends AvApi { 4 | constructor(config) { 5 | super({ 6 | path: 'api/sdk/platform', 7 | name: 'permissions', 8 | ...config, 9 | }); 10 | } 11 | 12 | async getPermissions(id, region) { 13 | return this.query({ 14 | params: { id, region }, 15 | }); 16 | } 17 | } 18 | 19 | export const avPermissionsApi = new AvPermissionsApi(); 20 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/providers.js: -------------------------------------------------------------------------------- 1 | import AvApi from '../api'; 2 | 3 | export default class AvProvidersApi extends AvApi { 4 | constructor(config) { 5 | super({ 6 | path: 'api/internal', 7 | name: 'providers', 8 | ...config, 9 | }); 10 | } 11 | 12 | async getProviders(customerId, config) { 13 | const queryConfig = this.addParams({ customerId }, config); 14 | return this.query(queryConfig); 15 | } 16 | 17 | normalize(providers) { 18 | const cloned = [...providers]; 19 | 20 | for (const provider of cloned) { 21 | provider.name = provider.businessName || `${provider.lastName}, ${provider.firstName}`; 22 | } 23 | 24 | return cloned; 25 | } 26 | } 27 | 28 | export const avProvidersApi = new AvProvidersApi(); 29 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/regions.js: -------------------------------------------------------------------------------- 1 | import AvApi from '../api'; 2 | import { avUserApi } from './user'; 3 | 4 | export default class AvRegionsApi extends AvApi { 5 | constructor(config) { 6 | super({ 7 | path: 'api/sdk/platform', 8 | name: 'regions', 9 | sessionBust: false, 10 | pageBust: true, 11 | ...config, 12 | }); 13 | } 14 | 15 | getQueryResultKey() { 16 | return 'regions'; 17 | } 18 | 19 | afterUpdate = (response) => { 20 | this.setPageBust(); 21 | return response; 22 | }; 23 | 24 | async getRegions(config) { 25 | if (config?.params?.userId) { 26 | return this.query(config); 27 | } 28 | 29 | const user = await avUserApi.me(); 30 | const queryConfig = this.addParams({ userId: user.id }, config); 31 | 32 | return this.query(queryConfig); 33 | } 34 | 35 | async getCurrentRegion() { 36 | return this.query({ 37 | params: { 38 | currentlySelected: true, 39 | }, 40 | }); 41 | } 42 | } 43 | 44 | export const avRegionsApi = new AvRegionsApi(); 45 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/routeConfigurations.js: -------------------------------------------------------------------------------- 1 | import AvMicroserviceApi from '../ms'; 2 | 3 | export default class AvRouteConfigurationsApi extends AvMicroserviceApi { 4 | constructor(config) { 5 | super({ 6 | name: 'epdm/configuration-service/epdm/v1/route-configuration', 7 | ...config, 8 | }); 9 | } 10 | 11 | async getConfiguration(transactionTypeCode, submissionModeCode, payerId) { 12 | return this.query({ 13 | params: { transactionTypeCode, submissionModeCode, payerId }, 14 | }); 15 | } 16 | } 17 | 18 | export const avRouteConfigurationsApi = new AvRouteConfigurationsApi(); 19 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/slotmachine.js: -------------------------------------------------------------------------------- 1 | import AvMicroserviceApi from '../ms'; 2 | 3 | export default class AvSlotMachineApi extends AvMicroserviceApi { 4 | constructor(config) { 5 | super({ 6 | name: 'spc/slotmachine/graphql', 7 | ...config, 8 | }); 9 | } 10 | 11 | query(data, variables) { 12 | return this.create({ query: data, variables }); 13 | } 14 | } 15 | 16 | export const avSlotMachineApi = new AvSlotMachineApi(); 17 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/spaces.js: -------------------------------------------------------------------------------- 1 | import AvApi from '../api'; 2 | 3 | export default class AvSpacesApi extends AvApi { 4 | constructor(config) { 5 | super({ 6 | path: 'api/sdk/platform', 7 | name: 'spaces', 8 | ...config, 9 | }); 10 | } 11 | 12 | parseSpaceId(query) { 13 | const pairs = query.substr(1).split('&'); 14 | 15 | let spaceId = ''; 16 | 17 | if (Array.isArray(pairs)) { 18 | for (const item of pairs) { 19 | const pair = item.split('='); 20 | const key = pair[0]; 21 | if (key === 'spaceId') { 22 | spaceId = pair[1] && decodeURIComponent(pair[1]); 23 | } 24 | } 25 | } 26 | 27 | return spaceId; 28 | } 29 | 30 | async getSpaceName(spaceId) { 31 | if (!spaceId) { 32 | throw new Error('[spaceId] must be defined'); 33 | } 34 | const response = await this.get(spaceId); 35 | return response.data.name; 36 | } 37 | } 38 | 39 | export const avSpacesApi = new AvSpacesApi(); 40 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/telemetry.js: -------------------------------------------------------------------------------- 1 | import set from 'lodash/set'; 2 | import AvMicroserviceApi from '../ms'; 3 | import flattenObject from '../flatten-object'; 4 | 5 | export default class AvTelemetryApi extends AvMicroserviceApi { 6 | constructor(config) { 7 | super({ 8 | name: 'spc/analytics/telemetry', 9 | ...config, 10 | }); 11 | } 12 | 13 | send(level, data) { 14 | set(data, 'telemetryBody.level', level); 15 | const flattened = flattenObject(data); 16 | 17 | const fields = Object.keys(flattened) 18 | .map((key) => { 19 | const name = key.replaceAll(/\[\d+]/g, '[]'); 20 | const value = flattened[key]; 21 | return `${name}=${encodeURIComponent(value)}`; 22 | }) 23 | .join('&'); 24 | 25 | return fields; 26 | } 27 | 28 | debug(data) { 29 | return this.sendBeacon(this.send('debug', data)); 30 | } 31 | 32 | info(data) { 33 | return this.sendBeacon(this.send('info', data)); 34 | } 35 | 36 | warn(data) { 37 | return this.sendBeacon(this.send('warn', data)); 38 | } 39 | 40 | error(data) { 41 | return this.sendBeacon(this.send('error', data)); 42 | } 43 | } 44 | 45 | export const avTelemetryApi = new AvTelemetryApi(); 46 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/tests/codes.test.js: -------------------------------------------------------------------------------- 1 | import AvCodesApi from '../codes'; 2 | 3 | describe('AvCodesApi', () => { 4 | let api = new AvCodesApi(); 5 | beforeEach(() => { 6 | api = new AvCodesApi(); 7 | }); 8 | 9 | test('should be defined', () => { 10 | expect(api).toBeDefined(); 11 | }); 12 | 13 | test('url should be correct', () => { 14 | expect(api.getUrl(api.config())).toBe('/api/v1/codes'); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/tests/disclaimers.test.js: -------------------------------------------------------------------------------- 1 | import AvDisclaimersApi from '../disclaimers'; 2 | 3 | describe('AvDisclaimersApi', () => { 4 | let api; 5 | beforeEach(() => { 6 | api = new AvDisclaimersApi(); 7 | }); 8 | 9 | test('AvDisclaimersApi should be defined', () => { 10 | expect(api).toBeDefined(); 11 | }); 12 | 13 | test('url should be correct', () => { 14 | expect(api.getUrl(api.config())).toBe('/api/sdk/platform/v1/disclaimers'); 15 | }); 16 | 17 | test('getDisclaimers should query with id param added', async () => { 18 | api.query = jest.fn(); 19 | 20 | const id = 'testId'; 21 | const testConfig = { 22 | name: 'testName', 23 | params: { testParam: 'hello world' }, 24 | }; 25 | const expectedConfig = { ...testConfig }; 26 | Object.assign(expectedConfig.params, { id }); 27 | 28 | await api.getDisclaimers(id, testConfig); 29 | expect(api.query).toHaveBeenLastCalledWith(expectedConfig); 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/tests/dma.test.js: -------------------------------------------------------------------------------- 1 | import AvLogMessagesApiV2 from '../dma'; 2 | 3 | describe('AvLogMessagesApiV2', () => { 4 | let api; 5 | beforeEach(() => { 6 | api = new AvLogMessagesApiV2(); 7 | }); 8 | test('should be defined', () => { 9 | expect(api).toBeDefined(); 10 | }); 11 | 12 | test('url should be correct', () => { 13 | expect(api.getUrl(api.config())).toBe('/ms/api/availity/internal/spc/analytics/log'); 14 | }); 15 | 16 | test('send should generate fields correctly', () => { 17 | const fields = api.send('info', { testField1: 'test1', testField2: 'test2'}); 18 | expect(fields).toContain('level=info&entries.testField1=test1&entries.testField2=test2'); 19 | }); 20 | }); 21 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/tests/navigation.test.js: -------------------------------------------------------------------------------- 1 | import AvNavigationApi from '../navigation'; 2 | 3 | describe('AvNavigationApi', () => { 4 | let api; 5 | beforeEach(() => { 6 | api = new AvNavigationApi(); 7 | }); 8 | test('should be defined', () => { 9 | expect(api).toBeDefined(); 10 | }); 11 | 12 | test('url should be correct', () => { 13 | expect(api.getUrl(api.config())).toBe('/api/sdk/platform/v1/navigation/spaces'); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/tests/notifications.test.js: -------------------------------------------------------------------------------- 1 | import AvNotificationsApi from '../notifications'; 2 | 3 | describe('AvNotificationsApi', () => { 4 | let api; 5 | beforeEach(() => { 6 | api = new AvNotificationsApi(); 7 | }); 8 | 9 | test('should be defined', () => { 10 | expect(api).toBeDefined(); 11 | }); 12 | 13 | test('url should be correct', () => { 14 | expect(api.getUrl(api.config())).toBe('/api/v1/notifications'); 15 | }); 16 | 17 | test('deleteByTopic() should call remove with topic added to params.topicId', async () => { 18 | api.remove = jest.fn(); 19 | 20 | const topic = 'test delete topic'; 21 | const expectedConfig = { params: { topicId: topic } }; 22 | 23 | await api.deleteByTopic(topic); 24 | expect(api.remove).toHaveBeenLastCalledWith(expectedConfig); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/tests/pdf.test.js: -------------------------------------------------------------------------------- 1 | import AvPdfApi from '../pdf'; 2 | 3 | describe('AvPdfApi', () => { 4 | let api; 5 | beforeEach(() => { 6 | api = new AvPdfApi(); 7 | }); 8 | 9 | test('should be defined', () => { 10 | expect(api).toBeDefined(); 11 | }); 12 | 13 | test('url should be correct', () => { 14 | expect(api.getUrl(api.config())).toBe('/api/utils/v1/pdfs'); 15 | }); 16 | 17 | test('should call onPdf() when pdf completes', async () => { 18 | api.onPdf = jest.fn(); 19 | 20 | const response = { 21 | data: { 22 | links: { 23 | pdf: { 24 | href: '/path/to/sample.pdf', 25 | }, 26 | }, 27 | }, 28 | }; 29 | 30 | api.post = jest.fn(() => response); 31 | await api.getPdf({ html: 'hi', applicationId: 'foo', fileName: 'test' }); 32 | expect(api.onPdf).toHaveBeenCalled(); 33 | }); 34 | }); 35 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/tests/pdfv2.test.js: -------------------------------------------------------------------------------- 1 | import AvPdfMicroserviceApi from '../pdfv2'; 2 | 3 | describe('AvPdfMicroserviceApi', () => { 4 | let api; 5 | beforeEach(() => { 6 | api = new AvPdfMicroserviceApi(); 7 | }); 8 | 9 | test('should be defined', () => { 10 | expect(api).toBeDefined(); 11 | }); 12 | 13 | test('url should be correct', () => { 14 | expect(api.getUrl(api.config())).toBe('/ms/api/availity/internal/spc/pdf/'); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/tests/permissions.test.js: -------------------------------------------------------------------------------- 1 | import AvPermissionsApi from '../permissions'; 2 | 3 | describe('AvPermissionsApi', () => { 4 | let api; 5 | beforeEach(() => { 6 | api = new AvPermissionsApi(); 7 | }); 8 | 9 | test('should be defined', () => { 10 | expect(api).toBeDefined(); 11 | }); 12 | 13 | test('url should be correct', () => { 14 | expect(api.getUrl(api.config())).toBe('/api/sdk/platform/v1/permissions'); 15 | }); 16 | 17 | test('getPermissions() should query with permissionId and region params from arguments', async () => { 18 | api.query = jest.fn(); 19 | 20 | const id = 'testPermissionId'; 21 | const region = 'testRegion'; 22 | const expectedConfig = { params: { id, region } }; 23 | 24 | await api.getPermissions(id, region); 25 | expect(api.query).toHaveBeenLastCalledWith(expectedConfig); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/tests/routeConfigurations.test.js: -------------------------------------------------------------------------------- 1 | import AvRouteConfigurationsApi from '../routeConfigurations'; 2 | 3 | describe('AvRouteConfigurationsApi', () => { 4 | let api; 5 | beforeEach(() => { 6 | api = new AvRouteConfigurationsApi(); 7 | }); 8 | 9 | test('should be defined', () => { 10 | expect(api).toBeDefined(); 11 | }); 12 | 13 | test('url should be correct', () => { 14 | expect(api.getUrl(api.config())).toBe( 15 | '/ms/api/availity/internal/epdm/configuration-service/epdm/v1/route-configuration' 16 | ); 17 | }); 18 | 19 | test('getConfiguration should query with transactionTypeCode, submissionModeCode, and payerId params from arguments', async () => { 20 | api.query = jest.fn(); 21 | 22 | const transactionTypeCode = '1'; 23 | const submissionModeCode = '10'; 24 | const payerId = 'AVAILITY'; 25 | const expectedConfig = { params: { transactionTypeCode, submissionModeCode, payerId } }; 26 | 27 | await api.getConfiguration(transactionTypeCode, submissionModeCode, payerId); 28 | expect(api.query).toHaveBeenLastCalledWith(expectedConfig); 29 | }); 30 | }); 31 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/tests/slotmachine.test.js: -------------------------------------------------------------------------------- 1 | import AvSlotMachineApi from '../slotmachine'; 2 | 3 | describe('AvSlotMachineApi', () => { 4 | let api; 5 | beforeEach(() => { 6 | api = new AvSlotMachineApi(); 7 | }); 8 | 9 | test('should be defined', () => { 10 | expect(api).toBeDefined(); 11 | }); 12 | 13 | test('url should be correct', () => { 14 | expect(api.getUrl(api.config())).toBe('/ms/api/availity/internal/spc/slotmachine/graphql'); 15 | }); 16 | 17 | test('query should return valid data', async () => { 18 | const data = `query { 19 | space(id: "rkxw8tu_p7") { 20 | name 21 | id 22 | url 23 | tenant 24 | permissions 25 | metadata { 26 | name 27 | value 28 | } 29 | type 30 | link { 31 | text 32 | url 33 | target 34 | } 35 | } 36 | } 37 | `; 38 | 39 | api.create = jest.fn(); 40 | await api.query(data); 41 | expect(api.create).toHaveBeenLastCalledWith({ 42 | query: data, 43 | }); 44 | }); 45 | }); 46 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/tests/spaces.test.js: -------------------------------------------------------------------------------- 1 | import AvSpacesApi from '../spaces'; 2 | 3 | const get = jest.fn(() => 4 | Promise.resolve({ 5 | status: 200, 6 | data: { 7 | name: 'foo', 8 | }, 9 | }) 10 | ); 11 | 12 | describe('AvSpacesApi', () => { 13 | let api; 14 | 15 | beforeEach(() => { 16 | api = new AvSpacesApi(); 17 | api.get = get; 18 | }); 19 | 20 | test('should be defined', () => { 21 | expect(api).toBeDefined(); 22 | }); 23 | 24 | test('url should be correct', () => { 25 | expect(api.getUrl(api.config())).toBe('/api/sdk/platform/v1/spaces'); 26 | }); 27 | 28 | test('should parse space id', () => { 29 | const spaceId = api.parseSpaceId('?foo=bar&spaceId=12345'); 30 | expect(spaceId).toEqual('12345'); 31 | }); 32 | 33 | test('should get name from spaces resource', async () => { 34 | const name = await api.getSpaceName('1'); 35 | expect(name).toEqual('foo'); 36 | 37 | await expect(api.getSpaceName()).rejects.toThrow('[spaceId] must be defined'); 38 | }); 39 | }); 40 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/tests/user.test.js: -------------------------------------------------------------------------------- 1 | import AvUserApi from '../user'; 2 | 3 | describe('AvUserApi', () => { 4 | let api; 5 | beforeEach(() => { 6 | api = new AvUserApi(); 7 | }); 8 | 9 | test('should be defined', () => { 10 | expect(api).toBeDefined(); 11 | }); 12 | 13 | test('url should be correct', () => { 14 | expect(api.getUrl(api.config())).toBe('/api/sdk/platform/v1/users'); 15 | }); 16 | 17 | test("me() should get with id 'me'", async () => { 18 | api.get = jest.fn(async () => new Promise((resolve) => {resolve({ id: 'test' })})); 19 | 20 | await api.me(); 21 | expect(api.get).toHaveBeenLastCalledWith('me', undefined); 22 | 23 | const testConfig = { name: 'testName' }; 24 | await api.me(testConfig); 25 | expect(api.get).toHaveBeenLastCalledWith('me', testConfig); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/tests/userPermissions.test.js: -------------------------------------------------------------------------------- 1 | import AvUserPermissionsApi from '../userPermissions'; 2 | 3 | describe('AvUserPermissionsApi', () => { 4 | let api; 5 | beforeEach(() => { 6 | api = new AvUserPermissionsApi(); 7 | }); 8 | 9 | test('should be defined', () => { 10 | expect(api).toBeDefined(); 11 | }); 12 | 13 | test('url should be correct', () => { 14 | expect(api.getUrl(api.config())).toBe('/api/internal/v1/axi-user-permissions'); 15 | }); 16 | 17 | test('afterQuery should return response.data.axiUserPermissions if it exists or an empty array', () => { 18 | const testResponse1 = {}; 19 | const axiUserPermissions = ['testPermission']; 20 | const testResponse2 = { 21 | data: { 22 | axiUserPermissions, 23 | }, 24 | }; 25 | 26 | expect(api.afterQuery(testResponse1)).toEqual([]); 27 | expect(api.afterQuery(testResponse2)).toEqual(axiUserPermissions); 28 | }); 29 | 30 | test('getPermissions should query with permissionId and region params from arguments', async () => { 31 | api.query = jest.fn(); 32 | 33 | const permissionId = 'testPermissionId'; 34 | const region = 'testRegion'; 35 | const expectedConfig = { params: { permissionId, region } }; 36 | 37 | await api.getPermissions(permissionId, region); 38 | expect(api.query).toHaveBeenLastCalledWith(expectedConfig); 39 | }); 40 | }); 41 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/tests/webQL.test.js: -------------------------------------------------------------------------------- 1 | import AvWebQLApi from '../webQL'; 2 | 3 | describe('AvWebQLApi', () => { 4 | let api; 5 | beforeEach(() => { 6 | api = new AvWebQLApi(); 7 | }); 8 | 9 | test('should be defined', () => { 10 | expect(api).toBeDefined(); 11 | }); 12 | 13 | test('url should be correct', () => { 14 | expect(api.getUrl(api.config())).toBe('/ms/api/availity/internal/spc/web/graphql'); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/user.js: -------------------------------------------------------------------------------- 1 | import AvApi from '../api'; 2 | 3 | export default class AvUserApi extends AvApi { 4 | constructor(config) { 5 | super({ 6 | path: 'api/sdk/platform', 7 | name: 'users', 8 | ...config, 9 | }); 10 | } 11 | 12 | async me(config) { 13 | const response = await this.get('me', config); 14 | return response.data; 15 | } 16 | } 17 | 18 | export const avUserApi = new AvUserApi(); 19 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/userPermissions.js: -------------------------------------------------------------------------------- 1 | import qs from 'qs'; 2 | import AvApi from '../api'; 3 | 4 | export default class AvUserPermissionsApi extends AvApi { 5 | constructor(config) { 6 | super({ 7 | path: 'api/internal', 8 | name: 'axi-user-permissions', 9 | paramsSerializer: (params) => qs.stringify(params, { arrayFormat: 'repeat' }), 10 | ...config, 11 | }); 12 | } 13 | 14 | afterQuery(response) { 15 | return response?.data?.axiUserPermissions || []; 16 | } 17 | 18 | async getPermissions(permissionId, region) { 19 | return this.query({ 20 | params: { permissionId, region }, 21 | }); 22 | } 23 | } 24 | 25 | export const avUserPermissionsApi = new AvUserPermissionsApi(); 26 | -------------------------------------------------------------------------------- /packages/api-axios/src/resources/webQL.js: -------------------------------------------------------------------------------- 1 | import AvMicroserviceApi from '../ms'; 2 | 3 | export default class AvWebQLApi extends AvMicroserviceApi { 4 | constructor(config) { 5 | super({ 6 | name: 'spc/web/graphql', 7 | ...config, 8 | }); 9 | } 10 | } 11 | 12 | export const avWebQLApi = new AvWebQLApi(); 13 | -------------------------------------------------------------------------------- /packages/api-axios/src/tests/flattenObject.test.js: -------------------------------------------------------------------------------- 1 | import flattenObject, { parseValue } from '../flatten-object'; 2 | 3 | describe('flatten-object', () => { 4 | test('parse a value', () => { 5 | let value; 6 | expect(parseValue(value)).toBeUndefined(); 7 | 8 | value = null; 9 | expect(parseValue(value)).toBeNull(); 10 | 11 | value = {}; 12 | expect(parseValue(value)).toEqual('[object Object]'); 13 | }); 14 | 15 | test('flatten an object', () => { 16 | const value = { foo: 'bar', bar: { baz: 'buzz' } }; 17 | const flattened = flattenObject(value); 18 | expect(flattened['bar.baz']).toEqual('buzz'); 19 | }); 20 | }); 21 | -------------------------------------------------------------------------------- /packages/api-axios/src/tests/ms.test.js: -------------------------------------------------------------------------------- 1 | import AvMicroserviceApi from '../ms'; 2 | 3 | describe('AvMicroserviceAPi', () => { 4 | let ms; 5 | beforeEach(() => { 6 | ms = new AvMicroserviceApi({ name: 'urlPath' }); 7 | }); 8 | 9 | test('should be defined', () => { 10 | expect(ms).toBeDefined(); 11 | }); 12 | 13 | test('url should be correct', () => { 14 | expect(ms.getRequestUrl()).toBe('/ms/api/availity/internal/urlPath'); 15 | }); 16 | 17 | test('should use an absolute url', () => { 18 | const api = new AvMicroserviceApi({ url: 'http://test-apps.com' }); 19 | 20 | expect(api.getRequestUrl()).toBe('http://test-apps.com/ms/api/availity/internal/'); 21 | expect(api.getUrl({ id: 'serviceName' })).toBe('http://test-apps.com/ms/api/availity/internal/serviceName'); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /packages/api-axios/src/tests/options.test.js: -------------------------------------------------------------------------------- 1 | import options from '../options'; 2 | 3 | describe('Api options', () => { 4 | test('should be defined', () => { 5 | expect(options).toBeDefined(); 6 | expect(options.API).toBeDefined(); 7 | expect(options.MS).toBeDefined(); 8 | }); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/api-axios/src/tests/proxy.test.js: -------------------------------------------------------------------------------- 1 | import AvProxyApi from '../proxy'; 2 | 3 | describe('AvProxyApi', () => { 4 | let proxy; 5 | beforeEach(() => { 6 | proxy = new AvProxyApi({ tenant: 'tenant' }); 7 | }); 8 | 9 | test('should be defined', () => { 10 | expect(proxy).toBeDefined(); 11 | }); 12 | 13 | test('should reject if tenant not provided', () => { 14 | expect(() => new AvProxyApi()).toThrow('[config.tenant] must be defined'); 15 | }); 16 | 17 | test('path is generated in constructor', () => { 18 | expect(proxy.config().path).toBe('api/v1/proxy/tenant'); 19 | }); 20 | 21 | test('url is created properly', () => { 22 | const api = new AvProxyApi({ tenant: 'foo', name: 'v1/test/bar/baz' }); 23 | 24 | expect(api.getRequestUrl()).toBe('/api/v1/proxy/foo/v1/test/bar/baz'); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /packages/api-axios/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["."], 4 | "exclude": ["dist", "build", "node_modules", "mocks"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/api-axios/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"], 7 | "allowJs": true 8 | }, 9 | "include": ["**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /packages/api-core/.npmignore: -------------------------------------------------------------------------------- 1 | src/**/*test.js 2 | -------------------------------------------------------------------------------- /packages/api-core/README.md: -------------------------------------------------------------------------------- 1 | # @availity/api-core 2 | 3 | > Base API definitions for the Availity REST API. 4 | 5 | [![Version](https://img.shields.io/npm/v/@availity/api-core.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/api-core) 6 | [![NPM Downloads](https://img.shields.io/npm/dt/@availity/api-core.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/api-core) 7 | 8 | ## Important Note 9 | 10 | This package is now considered deprecated. It has been combined with [@availity/api-axios](../api-axios/README.md) as of `version 6`. You can safely upgrade to `@availity/api-axios` and remove the use of this package. 11 | 12 | ## Install 13 | 14 | ### NPM 15 | 16 | ```bash 17 | npm install @availity/api-core 18 | ``` 19 | 20 | ### Yarn 21 | 22 | ```bash 23 | yarn add @availity/api-core 24 | ``` 25 | 26 | ## Documentation 27 | 28 | Check out more documentation at [availity.github.io](https://availity.github.io/sdk-js/api/getting-started) 29 | -------------------------------------------------------------------------------- /packages/api-core/jest.config.js: -------------------------------------------------------------------------------- 1 | const global = require('../../jest.config'); 2 | 3 | module.exports = { 4 | ...global, 5 | displayName: 'api-core', 6 | coverageDirectory: '../../coverage/api-core', 7 | }; 8 | -------------------------------------------------------------------------------- /packages/api-core/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@availity/api-core", 3 | "version": "11.0.0", 4 | "description": "Base API definitions for the Availity REST API", 5 | "keywords": [ 6 | "availity", 7 | "api", 8 | "http", 9 | "rest" 10 | ], 11 | "bugs": "https://github.com/Availity/sdk-js/issues", 12 | "repository": "https://github.com/Availity/sdk-js", 13 | "license": "MIT", 14 | "author": "Kasey Powers ", 15 | "browser": "./dist/index.js", 16 | "main": "./dist/index.js", 17 | "module": "./dist/index.mjs", 18 | "types": "./dist/index.d.ts", 19 | "exports": { 20 | "./package.json": "./package.json", 21 | ".": { 22 | "types": "./dist/index.d.ts", 23 | "import": "./dist/index.mjs", 24 | "require": "./dist/index.js" 25 | } 26 | }, 27 | "engines": { 28 | "node": "^20.0.0 || ^22.0.0" 29 | }, 30 | "scripts": { 31 | "build": "tsup src/index.js --format esm,cjs --dts", 32 | "dev": "tsup src/index.js --format esm,cjs --watch --dts", 33 | "lint": "eslint src", 34 | "lint:fix": "eslint src --fix", 35 | "clean": "rm -rf node_modules && rm -rf dist", 36 | "publish": "yarn npm publish --tolerate-republish --access public" 37 | }, 38 | "dependencies": { 39 | "@availity/env-var": "workspace:*", 40 | "@availity/resolve-url": "workspace:*", 41 | "qs": "^6.14.0" 42 | }, 43 | "devDependencies": { 44 | "tsup": "^8.4.0", 45 | "typescript": "^5.5.4" 46 | }, 47 | "publishConfig": { 48 | "access": "public" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /packages/api-core/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "api-core", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "projectType": "library", 5 | "targets": { 6 | "test": { 7 | "executor": "@nx/jest:jest", 8 | "outputs": ["{workspaceRoot}/coverage/api-core"], 9 | "options": { 10 | "jestConfig": "packages/api-core/jest.config.js" 11 | } 12 | }, 13 | "version": { 14 | "executor": "@jscutlery/semver:version", 15 | "options": { 16 | "preset": "angular", 17 | "commitMessageFormat": "chore({projectName}): release version ${version} [skip ci]", 18 | "tagPrefix": "@availity/{projectName}@", 19 | "baseBranch": "master" 20 | } 21 | }, 22 | "lint": { 23 | "executor": "@nx/eslint:lint", 24 | "options": { 25 | "eslintConfig": ".eslintrc.yaml", 26 | "silent": false, 27 | "fix": false, 28 | "cache": true, 29 | "cacheLocation": "./node_modules/.cache/api-core/.eslintcache", 30 | "maxWarnings": -1, 31 | "quiet": false, 32 | "noEslintrc": false, 33 | "hasTypeAwareRules": true, 34 | "cacheStrategy": "metadata" 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /packages/api-core/src/flattenObject.js: -------------------------------------------------------------------------------- 1 | // Copied from https://github.com/Availity/sdk-js/blob/master/packages/native-form/flattenObject.js 2 | const parseValue = (value) => (value === undefined || value === null ? value : value.toString()); 3 | 4 | const flattenObject = (ob) => 5 | Object.keys(ob).reduce((toReturn, k) => { 6 | if (Object.prototype.toString.call(ob[k]) === '[object Date]') { 7 | toReturn[k] = ob[k].toJSON(); 8 | } else if (ob[k] && typeof ob[k] === 'object') { 9 | const flatObject = flattenObject(ob[k]); 10 | const isArray = Array.isArray(ob[k]); 11 | 12 | for (const k2 of Object.keys(flatObject)) { 13 | toReturn[`${k}${isArray ? k2.replace(/^(\d+)(\..*)?/, '[$1]$2') : `.${k2}`}`] = parseValue(flatObject[k2]); 14 | } 15 | } else { 16 | toReturn[k] = parseValue(ob[k]); 17 | } 18 | 19 | return toReturn; 20 | }, {}); 21 | 22 | export default flattenObject; 23 | -------------------------------------------------------------------------------- /packages/api-core/src/index.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable unicorn/prefer-export-from */ 2 | import AvApi from './api'; 3 | import AvMicroservice from './ms'; 4 | 5 | export default AvApi; 6 | export { AvMicroservice }; 7 | -------------------------------------------------------------------------------- /packages/api-core/src/ms.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-explicit-any */ 2 | import AvApi from './api'; 3 | 4 | export default class AvMicroservice extends AvApi { 5 | getUrl(config: any, id?: string): string; 6 | } 7 | -------------------------------------------------------------------------------- /packages/api-core/src/ms.js: -------------------------------------------------------------------------------- 1 | import AvApi from './api'; 2 | import API_OPTIONS from './options'; 3 | import resolveHost from './resolve-host'; 4 | 5 | export default class AvMicroservice extends AvApi { 6 | constructor({ http, promise, merge, config }) { 7 | super({ 8 | http, 9 | promise, 10 | merge, 11 | config, 12 | }); 13 | this.defaultConfig = this.merge({}, API_OPTIONS.MS, config); 14 | } 15 | 16 | // override aries 1 url concatenation 17 | getUrl(config, id = '') { 18 | const { path, version, name, id: configId } = this.config(config); 19 | let parts = [path, version || '', name]; 20 | if (id || configId) { 21 | parts = [path, version || '', name, id || configId]; 22 | } 23 | const uri = parts.join('/').replaceAll(/\/+/g, '/').replace(/\/$/, ''); 24 | 25 | const hostname = resolveHost(config.host, config.window || window); 26 | return (hostname ? `https://${hostname}` : '') + uri; 27 | } 28 | 29 | // polling location is the same url 30 | getLocation(response) { 31 | return this.getUrl(response.config); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /packages/api-core/src/resolve-host.js: -------------------------------------------------------------------------------- 1 | import { getSpecificEnv } from '@availity/env-var'; 2 | 3 | const CLOUD_TO_APP_DOMAINS = { 4 | tst: 'test', 5 | stg: 'qa', 6 | qua: 'qa', 7 | prd: '', 8 | }; 9 | 10 | export default function resolveHost(host, overrideWindow) { 11 | if (host) return host; 12 | 13 | if ( 14 | /.*?\.(?:aw|az|gc)[nps|]\.availity\.com$/.test( 15 | overrideWindow.location.hostname 16 | ) 17 | ) { 18 | const env = getSpecificEnv(overrideWindow); 19 | if (env === 'local') return ''; 20 | 21 | const prefix = 22 | CLOUD_TO_APP_DOMAINS[env] === undefined ? env : CLOUD_TO_APP_DOMAINS[env]; 23 | return `${prefix && `${prefix}-`}apps.availity.com`; 24 | } 25 | 26 | return ''; 27 | } 28 | -------------------------------------------------------------------------------- /packages/api-core/src/resources/codes.js: -------------------------------------------------------------------------------- 1 | import AvApi from '../api'; 2 | 3 | export default class AvCodes extends AvApi { 4 | constructor({ http, promise, merge, config }) { 5 | const options = { 6 | name: 'codes', 7 | ...config, 8 | }; 9 | 10 | super({ 11 | http, 12 | promise, 13 | merge, 14 | config: options, 15 | }); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/api-core/src/resources/disclaimers.js: -------------------------------------------------------------------------------- 1 | import AvApi from '../api'; 2 | 3 | export default class AvDisclaimers extends AvApi { 4 | constructor({ http, promise, merge, config }) { 5 | const options = { 6 | path: '/api/sdk/platform', 7 | name: '/disclaimers', 8 | 9 | ...config, 10 | }; 11 | super({ 12 | http, 13 | promise, 14 | merge, 15 | config: options, 16 | }); 17 | } 18 | 19 | getDisclaimers(id, config) { 20 | const queryConfig = this.addParams({ id }, config); 21 | return this.query(queryConfig); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/api-core/src/resources/dma.js: -------------------------------------------------------------------------------- 1 | import flattenObject from '../flattenObject'; 2 | import AvMicroservice from '../ms'; 3 | 4 | class DmaLogMessages extends AvMicroservice { 5 | constructor({ http, promise, merge, config }) { 6 | const options = { 7 | name: 'spc/analytics/log', 8 | ...config, 9 | }; 10 | super({ 11 | http, 12 | promise, 13 | merge, 14 | config: options, 15 | }); 16 | } 17 | 18 | send(level, entries) { 19 | delete entries.level; 20 | const payload = { level, entries }; 21 | const flattened = flattenObject(payload); 22 | 23 | flattened.X_Client_ID = this.clientId; 24 | flattened.X_XSRF_TOKEN = document.cookie.replace( 25 | /(?:(?:^|.*;\s*)XSRF-TOKEN\s*=\s*([^;]*).*$)|^.*$/, 26 | '$1' 27 | ); 28 | 29 | const fields = Object.keys(flattened) 30 | .map((key) => { 31 | const name = key.replaceAll(/\[\d+]/g, '[]'); 32 | const value = flattened[key]; 33 | return `${name}=${encodeURIComponent(value)}`; 34 | }) 35 | .join('&'); 36 | 37 | return fields; 38 | } 39 | 40 | debug(entries) { 41 | return this.sendBeacon(this.send('debug', entries)); 42 | } 43 | 44 | info(entries) { 45 | return this.sendBeacon(this.send('info', entries)); 46 | } 47 | 48 | warn(entries) { 49 | return this.sendBeacon(this.send('warn', entries)); 50 | } 51 | 52 | error(entries) { 53 | return this.sendBeacon(this.send('error', entries)); 54 | } 55 | } 56 | 57 | export default DmaLogMessages; 58 | -------------------------------------------------------------------------------- /packages/api-core/src/resources/files.js: -------------------------------------------------------------------------------- 1 | import AvMicroservice from '../ms'; 2 | 3 | export default class AvFiles extends AvMicroservice { 4 | constructor({ http, promise, merge, config }) { 5 | const options = { 6 | name: 'core/vault/upload/v1', 7 | headers: { 8 | 'Content-Type': undefined, 9 | }, 10 | ...config, 11 | }; 12 | super({ 13 | http, 14 | promise, 15 | merge, 16 | config: options, 17 | }); 18 | } 19 | 20 | uploadFile(data, config) { 21 | if (!config.customerId || !config.clientId) { 22 | throw new Error( 23 | '[config.customerId] and [config.clientId] must be defined' 24 | ); 25 | } 26 | config = this.config(config); 27 | config.headers['X-Availity-Customer-ID'] = config.customerId; 28 | config.headers['X-Client-ID'] = config.clientId; 29 | 30 | return this.create(data, config); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /packages/api-core/src/resources/filesDelivery.js: -------------------------------------------------------------------------------- 1 | import AvMicroservice from '../ms'; 2 | 3 | export default class AvFilesDelivery extends AvMicroservice { 4 | constructor({ http, promise, merge, config }) { 5 | const options = { 6 | name: 'platform/file-upload-delivery/v1/batch/deliveries', 7 | headers: { 8 | 'Content-Type': 'application/json', 9 | }, 10 | polling: true, 11 | pollingMethod: 'GET', 12 | ...config, 13 | }; 14 | super({ 15 | http, 16 | promise, 17 | merge, 18 | config: options, 19 | }); 20 | } 21 | 22 | uploadFilesDelivery(data, config) { 23 | if (!config.customerId || !config.clientId) { 24 | throw new Error( 25 | '[config.customerId] and [config.clientId] must be defined' 26 | ); 27 | } 28 | config = this.config(config); 29 | config.headers['X-Availity-Customer-ID'] = config.customerId; 30 | config.headers['X-Client-ID'] = config.clientId; 31 | 32 | return this.create(data || {}, config); 33 | } 34 | 35 | getLocation(response) { 36 | const baseUrl = super.getLocation(response); 37 | return `${baseUrl}/${response.data.id}`; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/api-core/src/resources/logs.js: -------------------------------------------------------------------------------- 1 | import AvApi from '../api'; 2 | import flattenObject from '../flattenObject'; 3 | 4 | export default class AvLogMessages extends AvApi { 5 | constructor({ http, promise, merge, config }) { 6 | const options = { 7 | name: 'log-messages', 8 | ...config, 9 | }; 10 | super({ 11 | http, 12 | promise, 13 | merge, 14 | config: options, 15 | }); 16 | } 17 | 18 | send(level, entries) { 19 | delete entries.level; 20 | const payload = { level, entries }; 21 | const flattened = flattenObject(payload); 22 | 23 | flattened.X_Client_ID = this.clientId; 24 | flattened.X_XSRF_TOKEN = document.cookie.replace(/(?:(?:^|.*;\s*)XSRF-TOKEN\s*=\s*([^;]*).*$)|^.*$/, '$1'); 25 | 26 | const fields = Object.keys(flattened) 27 | .map((key) => { 28 | const name = key.replaceAll(/\[\d+]/g, '[]'); 29 | const value = flattened[key]; 30 | return `${name}=${encodeURIComponent(value)}`; 31 | }) 32 | .join('&'); 33 | 34 | return fields; 35 | } 36 | 37 | debug(entries) { 38 | return this.sendBeacon(this.send('debug', entries)); 39 | } 40 | 41 | info(entries) { 42 | return this.sendBeacon(this.send('info', entries)); 43 | } 44 | 45 | warn(entries) { 46 | return this.sendBeacon(this.send('warn', entries)); 47 | } 48 | 49 | error(entries) { 50 | return this.sendBeacon(this.send('error', entries)); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /packages/api-core/src/resources/navigation.js: -------------------------------------------------------------------------------- 1 | import AvApi from '../api'; 2 | 3 | export default class AvNavigation extends AvApi { 4 | constructor({ http, promise, merge, config }) { 5 | const options = { 6 | path: 'api/sdk/platform', 7 | name: 'navigation/spaces', 8 | ...config, 9 | }; 10 | super({ 11 | http, 12 | promise, 13 | merge, 14 | config: options, 15 | }); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/api-core/src/resources/notifications.js: -------------------------------------------------------------------------------- 1 | import AvApi from '../api'; 2 | 3 | export default class AvNotifications extends AvApi { 4 | constructor({ http, promise, merge, config }) { 5 | const options = { 6 | path: 'api', 7 | name: 'notifications', 8 | ...config, 9 | }; 10 | super({ 11 | http, 12 | promise, 13 | merge, 14 | config: options, 15 | }); 16 | } 17 | 18 | deleteByTopic(topic, config) { 19 | const removeConfig = this.addParams({ topicId: topic }, config); 20 | return this.remove(removeConfig); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/api-core/src/resources/pdfs.js: -------------------------------------------------------------------------------- 1 | import AvApi from '../api'; 2 | 3 | export default class AvPdfs extends AvApi { 4 | constructor({ http, promise, merge, config }) { 5 | const options = { 6 | path: 'api/utils', 7 | name: 'pdfs', 8 | ...config, 9 | }; 10 | super({ 11 | http, 12 | promise, 13 | merge, 14 | config: options, 15 | }); 16 | } 17 | 18 | onPdf(response) { 19 | window.location = response.data.links.pdf.href; 20 | } 21 | 22 | getPdf(data, config) { 23 | if (!data.applicationId || !data.fileName || !data.html) { 24 | throw new Error('[applicationId], [fileName] and [html] must be defined'); 25 | } 26 | 27 | return this.post(data, config).then(this.onPdf); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /packages/api-core/src/resources/permissions.js: -------------------------------------------------------------------------------- 1 | import AvApi from '../api'; 2 | 3 | export default class AvPermissions extends AvApi { 4 | constructor({ http, promise, merge, config }) { 5 | const options = { 6 | path: 'api/sdk/platform', 7 | name: 'permissions', 8 | ...config, 9 | }; 10 | super({ 11 | http, 12 | promise, 13 | merge, 14 | config: options, 15 | }); 16 | } 17 | 18 | getPermissions(id, region) { 19 | return this.query({ 20 | params: { id, region }, 21 | }); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/api-core/src/resources/providers.js: -------------------------------------------------------------------------------- 1 | import AvApi from '../api'; 2 | 3 | export default class AvProviders extends AvApi { 4 | constructor({ http, promise, merge, config }) { 5 | const options = { 6 | path: 'api/internal', 7 | name: 'providers', 8 | ...config, 9 | }; 10 | super({ 11 | http, 12 | promise, 13 | merge, 14 | config: options, 15 | }); 16 | } 17 | 18 | getProviders(customerId, config) { 19 | const queryConfig = this.addParams({ customerId }, config); 20 | return this.query(queryConfig); 21 | } 22 | 23 | normalize(providers) { 24 | const cloned = [...providers]; 25 | 26 | for (const provider of cloned) { 27 | provider.name = provider.businessName || `${provider.lastName}, ${provider.firstName}`; 28 | } 29 | 30 | return cloned; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /packages/api-core/src/resources/proxy.js: -------------------------------------------------------------------------------- 1 | import AvApi from '../api'; 2 | 3 | export default class AvProxy extends AvApi { 4 | constructor({ http, promise, merge, config }) { 5 | if (!config || !config.tenant) { 6 | throw new Error('Must specify tenant name for Proxy'); 7 | } 8 | const options = { 9 | path: `api/v1/proxy/${config.tenant}`, 10 | version: '', 11 | ...config, 12 | }; 13 | super({ 14 | http, 15 | promise, 16 | merge, 17 | config: options, 18 | }); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/api-core/src/resources/regions.js: -------------------------------------------------------------------------------- 1 | import AvApi from '../api'; 2 | 3 | export default class AvRegions extends AvApi { 4 | constructor({ http, promise, merge, avUsers, config }) { 5 | const options = { 6 | path: 'api/sdk/platform', 7 | name: 'regions', 8 | sessionBust: false, 9 | pageBust: true, 10 | ...config, 11 | }; 12 | super({ 13 | http, 14 | promise, 15 | merge, 16 | config: options, 17 | }); 18 | this.avUsers = avUsers; 19 | } 20 | 21 | afterUpdate(response) { 22 | this.setPageBust(); 23 | return response; 24 | } 25 | 26 | getRegions(config) { 27 | if (config && config.params && config.params.userId) { 28 | return this.query(config); 29 | } 30 | 31 | if (!this.avUsers || !this.avUsers.me) { 32 | throw new Error('avUsers must be defined'); 33 | } 34 | 35 | return this.avUsers.me().then((user) => { 36 | const queryConfig = this.addParams({ userId: user.id }, config); 37 | return this.query(queryConfig); 38 | }); 39 | } 40 | 41 | getCurrentRegion() { 42 | return this.query({ 43 | params: { 44 | currentlySelected: true, 45 | }, 46 | }); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /packages/api-core/src/resources/slotmachine.js: -------------------------------------------------------------------------------- 1 | import AvMicroservice from '../ms'; 2 | 3 | export default class AvSlotMachine extends AvMicroservice { 4 | constructor({ http, promise, merge, config }) { 5 | const options = { 6 | name: 'spc/slotmachine/graphql', 7 | ...config, 8 | }; 9 | super({ 10 | http, 11 | promise, 12 | merge, 13 | config: options, 14 | }); 15 | } 16 | 17 | query(data, variables) { 18 | return this.create({ query: data, variables }); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/api-core/src/resources/spaces.js: -------------------------------------------------------------------------------- 1 | import AvApi from '../api'; 2 | 3 | export default class AvSpaces extends AvApi { 4 | constructor({ http, promise, merge, config }) { 5 | const options = { 6 | path: 'api/sdk/platform', 7 | name: 'spaces', 8 | ...config, 9 | }; 10 | super({ 11 | http, 12 | promise, 13 | merge, 14 | config: options, 15 | }); 16 | } 17 | 18 | parseSpaceId(query) { 19 | const pairs = query.substr(1).split('&'); 20 | 21 | let spaceId = ''; 22 | 23 | if (Array.isArray(pairs)) { 24 | for (const item of pairs) { 25 | const pair = item.split('='); 26 | const key = pair[0]; 27 | if (key === 'spaceId') { 28 | spaceId = pair[1] && decodeURIComponent(pair[1]); 29 | } 30 | } 31 | } 32 | return spaceId; 33 | } 34 | 35 | getSpaceName(spaceId) { 36 | if (!spaceId) { 37 | throw new Error('[spaceId] must be defined'); 38 | } 39 | return this.get(spaceId).then((response) => response.data.name); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /packages/api-core/src/resources/tests/codes.test.js: -------------------------------------------------------------------------------- 1 | import AvCodes from '../codes'; 2 | 3 | const mockHttp = jest.fn(() => Promise.resolve({})); 4 | const mockMerge = jest.fn((...args) => Object.assign(...args)); 5 | 6 | describe('AvCodes', () => { 7 | let api; 8 | 9 | test('should be defined', () => { 10 | api = new AvCodes({ 11 | http: mockHttp, 12 | promise: Promise, 13 | merge: mockMerge, 14 | config: {}, 15 | }); 16 | expect(api).toBeDefined(); 17 | }); 18 | 19 | test('should handle no config passed in', () => { 20 | api = new AvCodes({ 21 | http: mockHttp, 22 | promise: Promise, 23 | merge: mockMerge, 24 | }); 25 | expect(api).toBeDefined(); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /packages/api-core/src/resources/tests/disclaimers.test.js: -------------------------------------------------------------------------------- 1 | import AvDisclaimers from '../disclaimers'; 2 | 3 | const mockHttp = jest.fn(() => Promise.resolve({})); 4 | const mockMerge = jest.fn((...args) => Object.assign(...args)); 5 | 6 | describe('AvDisclaimers', () => { 7 | let api; 8 | 9 | test('AvDisclaimers should be defined', () => { 10 | api = new AvDisclaimers({ 11 | http: mockHttp, 12 | promise: Promise, 13 | merge: mockMerge, 14 | config: {}, 15 | }); 16 | expect(api).toBeDefined(); 17 | }); 18 | 19 | test('AvDisclaimers should handle no config passed in', () => { 20 | api = new AvDisclaimers({ 21 | http: mockHttp, 22 | promise: Promise, 23 | merge: mockMerge, 24 | }); 25 | expect(api).toBeDefined(); 26 | }); 27 | 28 | test('getDisclaimers should query with id param added', () => { 29 | api = new AvDisclaimers({ 30 | http: mockHttp, 31 | promise: Promise, 32 | merge: mockMerge, 33 | config: {}, 34 | }); 35 | api.query = jest.fn(); 36 | 37 | const id = 'testId'; 38 | const testConfig = { 39 | name: 'testName', 40 | params: { testParam: 'hello world' }, 41 | }; 42 | const expectedConfig = { ...testConfig }; 43 | Object.assign(expectedConfig.params, { id }); 44 | api.getDisclaimers(id, testConfig); 45 | expect(api.query).toHaveBeenLastCalledWith(expectedConfig); 46 | }); 47 | }); 48 | -------------------------------------------------------------------------------- /packages/api-core/src/resources/tests/dma.test.js: -------------------------------------------------------------------------------- 1 | import AvLogMessagesV2 from '../dma'; 2 | 3 | const mockHttp = jest.fn(() => Promise.resolve({})); 4 | const mockMerge = jest.fn((...args) => Object.assign(...args)); 5 | 6 | describe('AvLogMessages', () => { 7 | let api; 8 | test('should be defined', () => { 9 | api = new AvLogMessagesV2({ 10 | http: mockHttp, 11 | promise: Promise, 12 | merge: mockMerge, 13 | config: {}, 14 | }); 15 | expect(api).toBeDefined(); 16 | 17 | const fields = api.send('info', { testField1: 'test1', testField2: 'test2'}); 18 | expect(fields).toContain('level=info&entries.testField1=test1&entries.testField2=test2'); 19 | }); 20 | }); 21 | -------------------------------------------------------------------------------- /packages/api-core/src/resources/tests/navigation.test.js: -------------------------------------------------------------------------------- 1 | import AvNavigation from '../navigation'; 2 | 3 | const mockHttp = jest.fn(() => Promise.resolve({})); 4 | const mockMerge = jest.fn((...args) => Object.assign(...args)); 5 | 6 | describe('AvNavigation', () => { 7 | let api; 8 | 9 | test('should be defined', () => { 10 | api = new AvNavigation({ 11 | http: mockHttp, 12 | promise: Promise, 13 | merge: mockMerge, 14 | config: {}, 15 | }); 16 | expect(api).toBeDefined(); 17 | }); 18 | 19 | test('should handle no config passed in', () => { 20 | api = new AvNavigation({ 21 | http: mockHttp, 22 | promise: Promise, 23 | merge: mockMerge, 24 | }); 25 | expect(api).toBeDefined(); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /packages/api-core/src/resources/tests/notifications.test.js: -------------------------------------------------------------------------------- 1 | import AvNotification from '../notifications'; 2 | 3 | const mockHttp = jest.fn(() => Promise.resolve({})); 4 | const mockMerge = jest.fn((...args) => Object.assign(...args)); 5 | 6 | describe('AvNotification', () => { 7 | let api; 8 | 9 | test('should be defined', () => { 10 | api = new AvNotification({ 11 | http: mockHttp, 12 | promise: Promise, 13 | merge: mockMerge, 14 | config: {}, 15 | }); 16 | expect(api).toBeDefined(); 17 | }); 18 | 19 | test('should handle no config passed in', () => { 20 | api = new AvNotification({ 21 | http: mockHttp, 22 | promise: Promise, 23 | merge: mockMerge, 24 | }); 25 | expect(api).toBeDefined(); 26 | }); 27 | 28 | test('deleteByTopic() should call remove with topic added to params.topicId', () => { 29 | api = new AvNotification({ 30 | http: mockHttp, 31 | promise: Promise, 32 | merge: mockMerge, 33 | config: {}, 34 | }); 35 | api.remove = jest.fn(); 36 | 37 | const topic = 'test delete topic'; 38 | const expectedConfig = { params: { topicId: topic } }; 39 | 40 | api.deleteByTopic(topic); 41 | expect(api.remove).toHaveBeenLastCalledWith(expectedConfig); 42 | }); 43 | }); 44 | -------------------------------------------------------------------------------- /packages/api-core/src/resources/tests/pdfs.test.js: -------------------------------------------------------------------------------- 1 | import AvPdfs from '../pdfs'; 2 | 3 | const mockHttp = jest.fn(() => Promise.resolve({})); 4 | const mockMerge = jest.fn((...args) => Object.assign(...args)); 5 | 6 | describe('AvPdfs', () => { 7 | let api; 8 | 9 | test('should be defined', () => { 10 | api = new AvPdfs({ 11 | http: mockHttp, 12 | promise: Promise, 13 | merge: mockMerge, 14 | config: {}, 15 | }); 16 | expect(api).toBeDefined(); 17 | }); 18 | 19 | test('should throw error with bad config', () => { 20 | api = new AvPdfs({ 21 | http: mockHttp, 22 | promise: Promise, 23 | merge: mockMerge, 24 | config: {}, 25 | }); 26 | expect(() => { 27 | api = api.getPdf({}); 28 | }).toThrow('[applicationId], [fileName] and [html] must be defined'); 29 | }); 30 | 31 | test('should call onPdf() when pdf completes', async () => { 32 | api = new AvPdfs({ 33 | http: mockHttp, 34 | promise: Promise, 35 | merge: mockMerge, 36 | config: {}, 37 | }); 38 | api.onPdf = jest.fn(); 39 | 40 | const response = { 41 | data: { 42 | links: { 43 | pdf: { 44 | href: '/path/to/sample.pdf', 45 | }, 46 | }, 47 | }, 48 | }; 49 | 50 | api.onResponse = jest.fn(() => response); 51 | await api.getPdf({ html: 'hi', applicationId: 'foo', fileName: 'test' }); 52 | expect(api.onPdf).toHaveBeenCalled(); 53 | }); 54 | }); 55 | -------------------------------------------------------------------------------- /packages/api-core/src/resources/tests/permissions.test.js: -------------------------------------------------------------------------------- 1 | import AvPermissions from '../permissions'; 2 | 3 | const mockHttp = jest.fn(() => Promise.resolve({})); 4 | const mockMerge = jest.fn((...args) => Object.assign(...args)); 5 | 6 | describe('AvPermissions', () => { 7 | let api; 8 | 9 | test('should be defined', () => { 10 | api = new AvPermissions({ 11 | http: mockHttp, 12 | promise: Promise, 13 | merge: mockMerge, 14 | config: {}, 15 | }); 16 | expect(api).toBeDefined(); 17 | }); 18 | 19 | test('should handle no config passed in', () => { 20 | api = new AvPermissions({ 21 | http: mockHttp, 22 | promise: Promise, 23 | merge: mockMerge, 24 | }); 25 | expect(api).toBeDefined(); 26 | }); 27 | 28 | test('getPermissions() should query with permissionId and region params from arguments', () => { 29 | api = new AvPermissions({ 30 | http: mockHttp, 31 | promise: Promise, 32 | merge: mockMerge, 33 | config: {}, 34 | }); 35 | api.query = jest.fn(); 36 | const id = 'testPermissionId'; 37 | const region = 'testRegion'; 38 | const expectedConfig = { params: { id, region } }; 39 | api.getPermissions(id, region); 40 | expect(api.query).toHaveBeenLastCalledWith(expectedConfig); 41 | }); 42 | }); 43 | -------------------------------------------------------------------------------- /packages/api-core/src/resources/tests/proxy.test.js: -------------------------------------------------------------------------------- 1 | import AvProxy from '../proxy'; 2 | 3 | const mockHttp = jest.fn(() => Promise.resolve({})); 4 | const mockMerge = jest.fn((...args) => Object.assign(...args)); 5 | 6 | describe('AvProxy', () => { 7 | let api; 8 | 9 | test('AvProxy should be defined', () => { 10 | api = new AvProxy({ 11 | http: mockHttp, 12 | promise: Promise, 13 | merge: mockMerge, 14 | config: { tenant: 'healthplan' }, 15 | }); 16 | expect(api).toBeDefined(); 17 | }); 18 | 19 | test('AvProxy should throw an error if config does not have tenant', () => { 20 | expect(() => { 21 | api = new AvProxy({ 22 | http: mockHttp, 23 | promise: Promise, 24 | merge: mockMerge, 25 | config: {}, 26 | }); 27 | }).toThrow('Must specify tenant name for Proxy'); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /packages/api-core/src/resources/tests/slotmachine.test.js: -------------------------------------------------------------------------------- 1 | import AvSlotMachine from '../slotmachine'; 2 | 3 | const mockHttp = jest.fn(() => Promise.resolve({})); 4 | const mockMerge = jest.fn((...args) => Object.assign(...args)); 5 | 6 | describe('AvSlotMachine', () => { 7 | let api; 8 | 9 | test('should be defined', () => { 10 | api = new AvSlotMachine({ 11 | http: mockHttp, 12 | promise: Promise, 13 | merge: mockMerge, 14 | config: {}, 15 | }); 16 | 17 | expect(api).toBeDefined(); 18 | }); 19 | 20 | test('should handle no config passed in', () => { 21 | api = new AvSlotMachine({ 22 | http: mockHttp, 23 | promise: Promise, 24 | merge: mockMerge, 25 | }); 26 | expect(api).toBeDefined(); 27 | }); 28 | 29 | test('query should return valid data', () => { 30 | api = new AvSlotMachine({ 31 | http: mockHttp, 32 | promise: Promise, 33 | merge: mockMerge, 34 | config: {}, 35 | }); 36 | 37 | const data = `query { 38 | space(id: "rkxw8tu_p7") { 39 | name 40 | id 41 | url 42 | tenant 43 | permissions 44 | metadata { 45 | name 46 | value 47 | } 48 | type 49 | link { 50 | text 51 | url 52 | target 53 | } 54 | } 55 | } 56 | `; 57 | 58 | api.create = jest.fn(); 59 | api.query(data); 60 | expect(api.create).toHaveBeenLastCalledWith({ 61 | query: data, 62 | }); 63 | }); 64 | }); 65 | -------------------------------------------------------------------------------- /packages/api-core/src/resources/tests/spaces.test.js: -------------------------------------------------------------------------------- 1 | import AvSpaces from '../spaces'; 2 | 3 | const mockHttp = jest.fn(() => Promise.resolve({})); 4 | const mockMerge = jest.fn((...args) => Object.assign(...args)); 5 | 6 | const get = jest.fn(() => 7 | Promise.resolve({ 8 | status: 200, 9 | data: { 10 | name: 'foo', 11 | }, 12 | }) 13 | ); 14 | 15 | describe('AvSpaces', () => { 16 | let api; 17 | 18 | beforeEach(() => { 19 | api = new AvSpaces({ 20 | http: mockHttp, 21 | promise: Promise, 22 | merge: mockMerge, 23 | config: {}, 24 | }); 25 | api.get = get; 26 | }); 27 | 28 | test('should be defined', () => { 29 | expect(api).toBeDefined(); 30 | }); 31 | 32 | test('should parse space id', () => { 33 | const spaceId = api.parseSpaceId('?foo=bar&spaceId=12345'); 34 | expect(spaceId).toEqual('12345'); 35 | }); 36 | 37 | test('should get name from spaces resource', async () => { 38 | const name = await api.getSpaceName('1'); 39 | expect(name).toEqual('foo'); 40 | 41 | expect(() => { 42 | api.getSpaceName(); 43 | }).toThrow('[spaceId] must be defined'); 44 | }); 45 | }); 46 | -------------------------------------------------------------------------------- /packages/api-core/src/resources/tests/user.test.js: -------------------------------------------------------------------------------- 1 | import AvUsers from '../user'; 2 | 3 | const mockPromise = jest.fn(() => Promise.resolve({})); 4 | const mockMerge = jest.fn((...args) => Object.assign(...args)); 5 | 6 | describe('AvUsers', () => { 7 | let api; 8 | 9 | test('should be defined', () => { 10 | api = new AvUsers({ 11 | http: mockPromise, 12 | promise: Promise, 13 | merge: mockMerge, 14 | config: {}, 15 | }); 16 | expect(api).toBeDefined(); 17 | }); 18 | 19 | test('should handle no config passed in', () => { 20 | api = new AvUsers({ 21 | http: mockPromise, 22 | promise: Promise, 23 | merge: mockMerge, 24 | }); 25 | expect(api).toBeDefined(); 26 | }); 27 | 28 | test("me() should get with id 'me'", () => { 29 | api = new AvUsers({ 30 | http: mockPromise, 31 | promise: Promise, 32 | merge: mockMerge, 33 | config: {}, 34 | }); 35 | api.get = mockPromise; 36 | api.me(); 37 | expect(api.get).toHaveBeenLastCalledWith('me', undefined); 38 | const testConfig = { name: 'testName' }; 39 | api.me(testConfig); 40 | expect(api.get).toHaveBeenLastCalledWith('me', testConfig); 41 | }); 42 | }); 43 | -------------------------------------------------------------------------------- /packages/api-core/src/resources/tests/webQL.test.js: -------------------------------------------------------------------------------- 1 | import AvWebQL from '../webQL'; 2 | 3 | const mockHttp = jest.fn(() => Promise.resolve({})); 4 | const mockMerge = jest.fn((...args) => Object.assign(...args)); 5 | 6 | describe('AvWebQL', () => { 7 | let api; 8 | 9 | test('should be defined', () => { 10 | api = new AvWebQL({ 11 | http: mockHttp, 12 | promise: Promise, 13 | merge: mockMerge, 14 | config: {}, 15 | }); 16 | expect(api).toBeDefined(); 17 | }); 18 | 19 | test('should handle no config passed in', () => { 20 | api = new AvWebQL({ 21 | http: mockHttp, 22 | promise: Promise, 23 | merge: mockMerge, 24 | }); 25 | expect(api).toBeDefined(); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /packages/api-core/src/resources/user.js: -------------------------------------------------------------------------------- 1 | import AvApi from '../api'; 2 | 3 | export default class AvUsers extends AvApi { 4 | constructor({ http, promise, merge, config }) { 5 | const options = { 6 | path: 'api/sdk/platform', 7 | name: 'users', 8 | ...config, 9 | }; 10 | super({ 11 | http, 12 | promise, 13 | merge, 14 | config: options, 15 | }); 16 | } 17 | 18 | me(config) { 19 | return this.get('me', config).then((response) => response.data); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/api-core/src/resources/userPermissions.js: -------------------------------------------------------------------------------- 1 | import qs from 'qs'; 2 | import AvApi from '../api'; 3 | 4 | export default class AvUserPermissions extends AvApi { 5 | constructor({ http, promise, merge, config }) { 6 | const options = { 7 | path: 'api/internal', 8 | name: 'axi-user-permissions', 9 | paramsSerializer: (params) => qs.stringify(params, { arrayFormat: 'repeat' }), 10 | ...config, 11 | }; 12 | super({ 13 | http, 14 | promise, 15 | merge, 16 | config: options, 17 | }); 18 | } 19 | 20 | afterQuery(response) { 21 | return response && response.data && response.data.axiUserPermissions ? response.data.axiUserPermissions : []; 22 | } 23 | 24 | getPermissions(permissionId, region) { 25 | return this.query({ 26 | params: { permissionId, region }, 27 | }); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /packages/api-core/src/resources/webQL.js: -------------------------------------------------------------------------------- 1 | import AvMicroservice from '../ms'; 2 | 3 | export default class AvWebQL extends AvMicroservice { 4 | constructor({ http, promise, merge, config }) { 5 | const options = { 6 | name: 'spc/web/graphql', 7 | ...config, 8 | }; 9 | super({ 10 | http, 11 | promise, 12 | merge, 13 | config: options, 14 | }); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/api-core/src/tests/flattenObject.test.js: -------------------------------------------------------------------------------- 1 | import flattenObject from '../flattenObject'; 2 | 3 | describe('flattenObject', () => { 4 | test('should flatten', () => { 5 | const obj = { 6 | int: 123, 7 | obj: { 8 | string: 'string', 9 | }, 10 | }; 11 | 12 | const flatObj = flattenObject(obj); 13 | expect(flatObj.int).toBe('123'); 14 | expect(flatObj['obj.string']).toBe('string'); 15 | }); 16 | 17 | test('handles undefined', () => { 18 | const obj = { 19 | int: 0, 20 | false: false, 21 | undefined, 22 | obj: { 23 | int: 123, 24 | string: 'string', 25 | }, 26 | }; 27 | 28 | const flatObj = flattenObject(obj); 29 | expect(flatObj.int).toBe('0'); 30 | expect(flatObj.false).toBe('false'); 31 | expect(flatObj['obj.string']).toBe('string'); 32 | expect(flatObj.undefined).toBeUndefined(); 33 | }); 34 | }); 35 | -------------------------------------------------------------------------------- /packages/api-core/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["."], 4 | "exclude": ["dist", "build", "node_modules"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/api-core/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"], 7 | "allowJs": true 8 | }, 9 | "include": ["**/*.test.ts", "**/*.d.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /packages/authorizations-axios/.npmignore: -------------------------------------------------------------------------------- 1 | **/*test.js 2 | -------------------------------------------------------------------------------- /packages/authorizations-axios/jest.config.js: -------------------------------------------------------------------------------- 1 | const global = require('../../jest.config'); 2 | 3 | module.exports = { 4 | ...global, 5 | displayName: 'authorizations-axios', 6 | coverageDirectory: '../../coverage/authorizations-axios', 7 | }; 8 | -------------------------------------------------------------------------------- /packages/authorizations-axios/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "authorizations-axios", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "projectType": "library", 5 | "targets": { 6 | "test": { 7 | "executor": "@nx/jest:jest", 8 | "outputs": ["{workspaceRoot}/coverage/authorizations-axios"], 9 | "options": { 10 | "jestConfig": "packages/authorizations-axios/jest.config.js" 11 | } 12 | }, 13 | "version": { 14 | "executor": "@jscutlery/semver:version", 15 | "options": { 16 | "preset": "angular", 17 | "commitMessageFormat": "chore({projectName}): release version ${version} [skip ci]", 18 | "tagPrefix": "@availity/{projectName}@", 19 | "baseBranch": "master", 20 | "trackDeps": true 21 | } 22 | }, 23 | "lint": { 24 | "executor": "@nx/eslint:lint", 25 | "options": { 26 | "eslintConfig": ".eslintrc.yaml", 27 | "silent": false, 28 | "fix": false, 29 | "cache": true, 30 | "cacheLocation": "./node_modules/.cache/authorizations-axios/.eslintcache", 31 | "maxWarnings": -1, 32 | "quiet": false, 33 | "noEslintrc": false, 34 | "hasTypeAwareRules": true, 35 | "cacheStrategy": "metadata" 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/authorizations-axios/src/index.d.ts: -------------------------------------------------------------------------------- 1 | import AvAuthorizationsCore from '@availity/authorizations-core'; 2 | 3 | declare const avAuthorizationsAxios: AvAuthorizationsCore; 4 | 5 | export default avAuthorizationsAxios; 6 | -------------------------------------------------------------------------------- /packages/authorizations-axios/src/index.js: -------------------------------------------------------------------------------- 1 | import AvAuthorizations from '@availity/authorizations-core'; 2 | import { avUserPermissionsApi, avRegionsApi } from '@availity/api-axios'; 3 | 4 | class AvAuthorizationsReact extends AvAuthorizations { 5 | constructor() { 6 | super(avUserPermissionsApi, avRegionsApi, Promise); 7 | } 8 | } 9 | 10 | export default new AvAuthorizationsReact(); 11 | -------------------------------------------------------------------------------- /packages/authorizations-axios/src/index.test.js: -------------------------------------------------------------------------------- 1 | import avAuthorizations from './index'; 2 | 3 | describe('AvAuthorizations', () => { 4 | test('AvAuthorizations should be defined', () => { 5 | expect(avAuthorizations).toBeDefined(); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /packages/authorizations-axios/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["."], 4 | "exclude": ["dist", "build", "node_modules"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/authorizations-axios/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"], 7 | "allowJs": true 8 | }, 9 | "include": ["**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /packages/authorizations-core/.npmignore: -------------------------------------------------------------------------------- 1 | **/*test.js 2 | -------------------------------------------------------------------------------- /packages/authorizations-core/README.md: -------------------------------------------------------------------------------- 1 | # @availity/authorizations-core 2 | 3 | > package providing a base authorizations class to help check which permissions a user has. 4 | 5 | [![Version](https://img.shields.io/npm/v/@availity/authorizations-core.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/authorizations-core) 6 | [![NPM Downloads](https://img.shields.io/npm/dt/@availity/authorizations-core.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/authorizations-core) 7 | [![Dependecy Status](https://img.shields.io/librariesio/release/npm/@availity/authorizations-core?style=for-the-badge)](https://github.com/Availity/sdk-js/blob/master/packages/authorizations-core/package.json) 8 | 9 | ## Install 10 | 11 | ### NPM 12 | 13 | ```bash 14 | npm install @availity/authorizations-core 15 | ``` 16 | 17 | ### Yarn 18 | 19 | ```bash 20 | yarn add @availity/authorizations-core 21 | ``` 22 | 23 | ## Documentation 24 | 25 | Check out more documentation at [availity.github.io](https://availity.github.io/sdk-js/api/authorizations) 26 | -------------------------------------------------------------------------------- /packages/authorizations-core/jest.config.js: -------------------------------------------------------------------------------- 1 | const global = require('../../jest.config'); 2 | 3 | module.exports = { 4 | ...global, 5 | displayName: 'authorizations-core', 6 | coverageDirectory: '../../coverage/authorizations-core', 7 | }; 8 | -------------------------------------------------------------------------------- /packages/authorizations-core/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@availity/authorizations-core", 3 | "version": "5.0.0", 4 | "description": "Base configurations for Availity Authorizations", 5 | "homepage": "https://availity.github.io/sdk-js/api/authorizations", 6 | "bugs": { 7 | "url": "https://github.com/availity/sdk-js/issues" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/availity/sdk-js.git", 12 | "directory": "packages/authorizations-core" 13 | }, 14 | "license": "MIT", 15 | "author": "Kasey Powers ", 16 | "browser": "./dist/index.js", 17 | "main": "./dist/index.js", 18 | "module": "./dist/index.mjs", 19 | "types": "./dist/index.d.ts", 20 | "exports": { 21 | "./package.json": "./package.json", 22 | ".": { 23 | "types": "./dist/index.d.ts", 24 | "import": "./dist/index.mjs", 25 | "require": "./dist/index.js" 26 | } 27 | }, 28 | "engines": { 29 | "node": "^20.0.0 || ^22.0.0" 30 | }, 31 | "scripts": { 32 | "build": "tsup src/index.js --format esm,cjs --dts", 33 | "dev": "tsup src/index.js --format esm,cjs --watch --dts", 34 | "lint": "eslint src", 35 | "lint:fix": "eslint src --fix", 36 | "clean": "rm -rf node_modules && rm -rf dist", 37 | "publish": "yarn npm publish --tolerate-republish --access public" 38 | }, 39 | "devDependencies": { 40 | "tsup": "^8.4.0", 41 | "typescript": "^5.5.4" 42 | }, 43 | "publishConfig": { 44 | "access": "public" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /packages/authorizations-core/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "authorizations-core", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "projectType": "library", 5 | "targets": { 6 | "test": { 7 | "executor": "@nx/jest:jest", 8 | "outputs": ["{workspaceRoot}/coverage/authorizations-core"], 9 | "options": { 10 | "jestConfig": "packages/authorizations-core/jest.config.js" 11 | } 12 | }, 13 | "version": { 14 | "executor": "@jscutlery/semver:version", 15 | "options": { 16 | "preset": "angular", 17 | "commitMessageFormat": "chore({projectName}): release version ${version} [skip ci]", 18 | "tagPrefix": "@availity/{projectName}@", 19 | "baseBranch": "master", 20 | "trackDeps": true 21 | } 22 | }, 23 | "lint": { 24 | "executor": "@nx/eslint:lint", 25 | "options": { 26 | "eslintConfig": ".eslintrc.yaml", 27 | "silent": false, 28 | "fix": false, 29 | "cache": true, 30 | "cacheLocation": "./node_modules/.cache/authorizations-core/.eslintcache", 31 | "maxWarnings": -1, 32 | "quiet": false, 33 | "noEslintrc": false, 34 | "hasTypeAwareRules": true, 35 | "cacheStrategy": "metadata" 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/authorizations-core/src/index.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-explicit-any */ 2 | declare class AvAuthorizations { 3 | constructor(avPermissions: any, avRegions: any, promise: any); 4 | 5 | avPermissions: any; 6 | 7 | avRegions: any; 8 | 9 | promise: any; 10 | 11 | authorizedMap: Record; 12 | 13 | isAuthorized(permissionId: any, region: any): any; 14 | 15 | isAnyAuthorized(permissionIds: any, region: any): any; 16 | 17 | getPermission(permissionId: any, region: any): any; 18 | 19 | getRegion(region: any): any; 20 | 21 | getPermissions(permissionIds: any, region: any): any; 22 | 23 | getMissingIds(ids: any, region?: string): any; 24 | 25 | getFromMap(ids: any, region?: string): any; 26 | 27 | addPermissions(ids: any, permissions: any, region: any): void; 28 | 29 | addPermission(permission: any, region?: string): void; 30 | 31 | getOrganizations(permissionId: any, region: any): any; 32 | 33 | getPayers(permissionId: any, organizationId: any, region: any): any; 34 | } 35 | 36 | export default AvAuthorizations; 37 | -------------------------------------------------------------------------------- /packages/authorizations-core/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["."], 4 | "exclude": ["dist", "build", "node_modules"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/authorizations-core/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"], 7 | "allowJs": true 8 | }, 9 | "include": ["**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /packages/dl-axios/.npmignore: -------------------------------------------------------------------------------- 1 | **/*test.js 2 | -------------------------------------------------------------------------------- /packages/dl-axios/README.md: -------------------------------------------------------------------------------- 1 | # @availity/dl-axios 2 | 3 | > Utility to download files from services 4 | 5 | [![Version](https://img.shields.io/npm/v/@availity/dl-axios.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/dl-axios) 6 | [![NPM Downloads](https://img.shields.io/npm/dt/@availity/dl-axios.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/dl-axios) 7 | [![Dependecy Status](https://img.shields.io/librariesio/release/npm/@availity/dl-axios?style=for-the-badge)](https://github.com/Availity/sdk-js/blob/master/packages/dl-axios/package.json) 8 | 9 | ## Install 10 | 11 | ### NPM 12 | 13 | ```bash 14 | npm install @availity/dl-axios 15 | ``` 16 | 17 | ### Yarn 18 | 19 | ```bash 20 | yarn add @availity/dl-axios 21 | ``` 22 | -------------------------------------------------------------------------------- /packages/dl-axios/jest.config.js: -------------------------------------------------------------------------------- 1 | const global = require('../../jest.config'); 2 | 3 | module.exports = { 4 | ...global, 5 | displayName: 'dl-axios', 6 | coverageDirectory: '../../coverage/dl-axios', 7 | }; 8 | -------------------------------------------------------------------------------- /packages/dl-axios/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dl-axios", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "projectType": "library", 5 | "targets": { 6 | "test": { 7 | "executor": "@nx/jest:jest", 8 | "outputs": ["{workspaceRoot}/coverage/dl-axios"], 9 | "options": { 10 | "jestConfig": "packages/dl-axios/jest.config.js" 11 | } 12 | }, 13 | "version": { 14 | "executor": "@jscutlery/semver:version", 15 | "options": { 16 | "preset": "angular", 17 | "commitMessageFormat": "chore({projectName}): release version ${version} [skip ci]", 18 | "tagPrefix": "@availity/{projectName}@", 19 | "baseBranch": "master", 20 | "trackDeps": true 21 | } 22 | }, 23 | "lint": { 24 | "executor": "@nx/eslint:lint", 25 | "options": { 26 | "eslintConfig": ".eslintrc.yaml", 27 | "silent": false, 28 | "fix": false, 29 | "cache": true, 30 | "cacheLocation": "./node_modules/.cache/dl-axios/.eslintcache", 31 | "maxWarnings": -1, 32 | "quiet": false, 33 | "noEslintrc": false, 34 | "hasTypeAwareRules": true, 35 | "cacheStrategy": "metadata" 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/dl-axios/src/download.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | import merge from 'lodash/merge'; 3 | import DownloadMicroservice from '@availity/dl-core'; 4 | 5 | export default class AvDownloadApi extends DownloadMicroservice { 6 | constructor(options) { 7 | super({ 8 | http: axios, 9 | promise: Promise, 10 | merge, 11 | config: options, 12 | }); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/dl-axios/src/index.d.ts: -------------------------------------------------------------------------------- 1 | import DownloadCore from '@availity/dl-core'; 2 | 3 | declare class AvDownloadApi extends DownloadCore {} 4 | 5 | export default AvDownloadApi; 6 | -------------------------------------------------------------------------------- /packages/dl-axios/src/index.js: -------------------------------------------------------------------------------- 1 | import AvDownloadApi from './download'; 2 | 3 | // eslint-disable-next-line unicorn/prefer-export-from 4 | export default AvDownloadApi; 5 | -------------------------------------------------------------------------------- /packages/dl-axios/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["."], 4 | "exclude": ["dist", "build", "node_modules"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/dl-axios/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"], 7 | "allowJs": true 8 | }, 9 | "include": ["**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /packages/dl-core/.npmignore: -------------------------------------------------------------------------------- 1 | **/*test.js 2 | -------------------------------------------------------------------------------- /packages/dl-core/README.md: -------------------------------------------------------------------------------- 1 | # @availity/dl-core 2 | 3 | > Utility to download files from services 4 | 5 | [![Version](https://img.shields.io/npm/v/@availity/dl-core.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/dl-core) 6 | [![NPM Downloads](https://img.shields.io/npm/dt/@availity/dl-core.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/dl-core) 7 | [![Dependecy Status](https://img.shields.io/librariesio/release/npm/@availity/dl-core?style=for-the-badge)](https://github.com/Availity/sdk-js/blob/master/packages/dl-core/package.json) 8 | 9 | ## Install 10 | 11 | ### NPM 12 | 13 | ```bash 14 | npm install @availity/api-core @availity/api-angular @availity/dl-core @availity/dl-angular 15 | ``` 16 | 17 | ### Yarn 18 | 19 | ```bash 20 | yarn add @availity/api-core @availity/api-angular @availity/dl-core @availity/dl-angular 21 | ``` 22 | 23 | ## Documentation 24 | 25 | Check out more documentation at [availity.github.io](https://availity.github.io/sdk-js/api/downloads) 26 | -------------------------------------------------------------------------------- /packages/dl-core/jest.config.js: -------------------------------------------------------------------------------- 1 | const global = require('../../jest.config'); 2 | 3 | module.exports = { 4 | ...global, 5 | displayName: 'dl-core', 6 | coverageDirectory: '../../coverage/dl-core', 7 | }; 8 | -------------------------------------------------------------------------------- /packages/dl-core/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dl-core", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "projectType": "library", 5 | "targets": { 6 | "test": { 7 | "executor": "@nx/jest:jest", 8 | "outputs": ["{workspaceRoot}/coverage/dl-core"], 9 | "options": { 10 | "jestConfig": "packages/dl-core/jest.config.js" 11 | } 12 | }, 13 | "version": { 14 | "executor": "@jscutlery/semver:version", 15 | "options": { 16 | "preset": "angular", 17 | "commitMessageFormat": "chore({projectName}): release version ${version} [skip ci]", 18 | "tagPrefix": "@availity/{projectName}@", 19 | "baseBranch": "master", 20 | "trackDeps": true 21 | } 22 | }, 23 | "lint": { 24 | "executor": "@nx/eslint:lint", 25 | "options": { 26 | "eslintConfig": ".eslintrc.yaml", 27 | "silent": false, 28 | "fix": false, 29 | "cache": true, 30 | "cacheLocation": "./node_modules/.cache/dl-core/.eslintcache", 31 | "maxWarnings": -1, 32 | "quiet": false, 33 | "noEslintrc": false, 34 | "hasTypeAwareRules": true, 35 | "cacheStrategy": "metadata" 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/dl-core/src/index.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-explicit-any */ 2 | import { AvMicroservice } from '@availity/api-core'; 3 | 4 | declare class DownloadMicroservice extends AvMicroservice { 5 | constructor({ http, promise, merge, config }); 6 | 7 | getAttachment(config: any): any; 8 | 9 | downloadAttachment(data: any, filename: any, mime: any): void; 10 | } 11 | 12 | export default DownloadMicroservice; 13 | -------------------------------------------------------------------------------- /packages/dl-core/src/index.js: -------------------------------------------------------------------------------- 1 | import { AvMicroservice } from '@availity/api-core'; 2 | import fileDownload from 'js-file-download'; 3 | 4 | export default class DownloadMicroservice extends AvMicroservice { 5 | constructor({ http, promise, merge, config }) { 6 | if (!config.clientId) { 7 | throw new Error('[config.clientId] must be defined'); 8 | } 9 | 10 | const options = { 11 | headers: { 'X-Client-ID': config.clientId }, 12 | responseType: 'blob', 13 | ...config, 14 | }; 15 | super({ http, promise, merge, config: options }); 16 | } 17 | 18 | getAttachment(config) { 19 | return this.query(config); 20 | } 21 | 22 | downloadAttachment(data, filename, mime) { 23 | fileDownload(data, filename, mime); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/dl-core/src/index.test.js: -------------------------------------------------------------------------------- 1 | import DownloadMicroservice from '.'; 2 | 3 | describe('dl.core', () => { 4 | it('should be defined', () => { 5 | expect(DownloadMicroservice).toBeTruthy(); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /packages/dl-core/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["."], 4 | "exclude": ["dist", "build", "node_modules"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/dl-core/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"], 7 | "allowJs": true 8 | }, 9 | "include": ["**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /packages/dockyard/.npmignore: -------------------------------------------------------------------------------- 1 | **/*test.js 2 | -------------------------------------------------------------------------------- /packages/dockyard/README.md: -------------------------------------------------------------------------------- 1 | # @availity/dockyard 2 | 3 | > Convert yup schema to a friendly docs object 4 | 5 | [![Version](https://img.shields.io/npm/v/@availity/dockyard.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/dockyard) 6 | [![NPM Downloads](https://img.shields.io/npm/dt/@availity/dockyard.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/dockyard) 7 | [![Dependecy Status](https://img.shields.io/librariesio/release/npm/@availity/dockyard?style=for-the-badge)](https://github.com/Availity/sdk-js/blob/master/packages/dockyard/package.json) 8 | 9 | ## Installation 10 | 11 | ### NPM 12 | 13 | ```bash 14 | npm install @availity/dockyard 15 | ``` 16 | 17 | ### Yarn 18 | 19 | ```bash 20 | yarn add @availity/dockyard 21 | ``` 22 | 23 | ## Usage 24 | 25 | ```javascript 26 | import yup from 'yup'; 27 | import getRules from '@availity/dockyard'; 28 | 29 | const schema = yup.object({ 30 | name: yup.string(), 31 | dateOfBirth: yup.date(), 32 | }); 33 | 34 | const rules = getRules(schema, options); 35 | ``` 36 | 37 | ### `options` 38 | 39 | ```js 40 | const options = { 41 | compileRequiredFields: false, 42 | excludeOneOf: false, 43 | excludeTypes: false, 44 | }; 45 | ``` 46 | 47 | - `compileRequiredFields`: removes the word 'required' from the description and adds an array of required fields to the object. 48 | - `excludeOneOf`: if oneOf is specified on an item, exclude it from the description. 49 | - `excludeTypes`: exclude types from the description. 50 | -------------------------------------------------------------------------------- /packages/dockyard/jest.config.js: -------------------------------------------------------------------------------- 1 | const global = require('../../jest.config'); 2 | 3 | module.exports = { 4 | ...global, 5 | displayName: 'dockyard', 6 | coverageDirectory: '../../coverage/dockyard', 7 | }; 8 | -------------------------------------------------------------------------------- /packages/dockyard/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@availity/dockyard", 3 | "version": "3.0.0", 4 | "description": "Convert yup schema to a friendly docs object", 5 | "keywords": [ 6 | "yup", 7 | "schema", 8 | "docs" 9 | ], 10 | "bugs": { 11 | "url": "https://github.com/availity/sdk-js/issues" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "git+https://github.com/availity/sdk-js.git", 16 | "directory": "packages/dockyard" 17 | }, 18 | "license": "MIT", 19 | "author": "Greg Martin ", 20 | "browser": "./dist/index.js", 21 | "main": "./dist/index.js", 22 | "module": "./dist/index.mjs", 23 | "types": "./dist/index.d.ts", 24 | "exports": { 25 | "./package.json": "./package.json", 26 | ".": { 27 | "types": "./dist/index.d.ts", 28 | "import": "./dist/index.mjs", 29 | "require": "./dist/index.js" 30 | } 31 | }, 32 | "engines": { 33 | "node": "^20.0.0 || ^22.0.0" 34 | }, 35 | "scripts": { 36 | "build": "tsup src/index.js --format esm,cjs --dts", 37 | "dev": "tsup src/index.js --format esm,cjs --watch --dts", 38 | "lint": "eslint src", 39 | "lint:fix": "eslint src --fix", 40 | "clean": "rm -rf node_modules && rm -rf dist", 41 | "publish": "yarn npm publish --tolerate-republish --access public" 42 | }, 43 | "dependencies": { 44 | "lodash": "^4.17.21" 45 | }, 46 | "devDependencies": { 47 | "tsup": "^8.4.0", 48 | "typescript": "^5.5.4", 49 | "yup": "^0.32.11" 50 | }, 51 | "publishConfig": { 52 | "access": "public" 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /packages/dockyard/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dockyard", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "projectType": "library", 5 | "targets": { 6 | "test": { 7 | "executor": "@nx/jest:jest", 8 | "outputs": ["{workspaceRoot}/coverage/dockyard"], 9 | "options": { 10 | "jestConfig": "packages/dockyard/jest.config.js" 11 | } 12 | }, 13 | "version": { 14 | "executor": "@jscutlery/semver:version", 15 | "options": { 16 | "preset": "angular", 17 | "commitMessageFormat": "chore({projectName}): release version ${version} [skip ci]", 18 | "tagPrefix": "@availity/{projectName}@", 19 | "baseBranch": "master", 20 | "trackDeps": true 21 | } 22 | }, 23 | "lint": { 24 | "executor": "@nx/eslint:lint", 25 | "options": { 26 | "eslintConfig": ".eslintrc.yaml", 27 | "silent": false, 28 | "fix": false, 29 | "cache": true, 30 | "cacheLocation": "./node_modules/.cache/dockyard/.eslintcache", 31 | "maxWarnings": -1, 32 | "quiet": false, 33 | "noEslintrc": false, 34 | "hasTypeAwareRules": true, 35 | "cacheStrategy": "metadata" 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/dockyard/src/index.d.ts: -------------------------------------------------------------------------------- 1 | declare const getRules: ( 2 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 3 | validation: any, 4 | { 5 | compileRequiredFields, 6 | excludeOneOf, 7 | excludeTypes, 8 | }?: { 9 | compileRequiredFields: boolean; 10 | excludeOneOf: boolean; 11 | excludeTypes: boolean; 12 | } 13 | ) => Record; 14 | -------------------------------------------------------------------------------- /packages/dockyard/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["."], 4 | "exclude": ["dist", "build", "node_modules"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/dockyard/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"], 7 | "allowJs": true 8 | }, 9 | "include": ["**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /packages/env-var/.npmignore: -------------------------------------------------------------------------------- 1 | **/*.test.js 2 | -------------------------------------------------------------------------------- /packages/env-var/README.md: -------------------------------------------------------------------------------- 1 | # @availity/env-var 2 | 3 | > Get run-time environment variables for immutable builds 4 | 5 | [![Version](https://img.shields.io/npm/v/@availity/env-var.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/env-var) 6 | [![NPM Downloads](https://img.shields.io/npm/dt/@availity/env-var.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/env-var) 7 | [![Dependecy Status](https://img.shields.io/librariesio/release/npm/@availity/env-var?style=for-the-badge)](https://github.com/Availity/sdk-js/blob/master/packages/env-var/package.json) 8 | 9 | ## Install 10 | 11 | ### NPM 12 | 13 | ```bash 14 | npm install @availity/env-var 15 | ``` 16 | 17 | ### Yarn 18 | 19 | ```bash 20 | yarn add @availity/env-var 21 | ``` 22 | 23 | ## Documentation 24 | 25 | Check out more documentation at [availity.github.io](https://availity.github.io/sdk-js/resources/env-var) 26 | -------------------------------------------------------------------------------- /packages/env-var/jest.config.js: -------------------------------------------------------------------------------- 1 | const global = require('../../jest.config'); 2 | 3 | module.exports = { 4 | ...global, 5 | displayName: 'env-var', 6 | coverageDirectory: '../../coverage/env-var', 7 | }; 8 | -------------------------------------------------------------------------------- /packages/env-var/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "env-var", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "projectType": "library", 5 | "targets": { 6 | "test": { 7 | "executor": "@nx/jest:jest", 8 | "outputs": ["{workspaceRoot}/coverage/env-var"], 9 | "options": { 10 | "jestConfig": "packages/env-var/jest.config.js" 11 | } 12 | }, 13 | "version": { 14 | "executor": "@jscutlery/semver:version", 15 | "options": { 16 | "preset": "angular", 17 | "commitMessageFormat": "chore({projectName}): release version ${version} [skip ci]", 18 | "tagPrefix": "@availity/{projectName}@", 19 | "baseBranch": "master", 20 | "trackDeps": true 21 | } 22 | }, 23 | "lint": { 24 | "executor": "@nx/eslint:lint", 25 | "options": { 26 | "eslintConfig": ".eslintrc.yaml", 27 | "silent": false, 28 | "fix": false, 29 | "cache": true, 30 | "cacheLocation": "./node_modules/.cache/env-var/.eslintcache", 31 | "maxWarnings": -1, 32 | "quiet": false, 33 | "noEslintrc": false, 34 | "hasTypeAwareRules": true, 35 | "cacheStrategy": "metadata" 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/env-var/src/index.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-explicit-any */ 2 | export type ENVIORNEMNT = 'local' | 'test' | 'qa' | 'prod'; 3 | 4 | interface EnvOpts { 5 | local?: T; 6 | test?: T; 7 | qa?: T; 8 | prod?: T; 9 | } 10 | 11 | declare function envVar(envOpts: EnvOpts, windowOverride?: Window, defaultVar?: T): T; 12 | declare function getCurrentEnv(windowOverride?: Window & typeof globalThis): string; 13 | declare function getLocation(href: string): HTMLAnchorElement; 14 | declare function getSpecificEnv(windowOverride?: Window & typeof globalThis): any; 15 | declare function setEnvironments(envs: EnvOpts, override?: boolean): void; 16 | declare function setSpecificEnvironments(envs: EnvOpts, override?: boolean): void; 17 | 18 | export { getCurrentEnv, getLocation, getSpecificEnv, setEnvironments, setSpecificEnvironments }; 19 | 20 | export default envVar; 21 | -------------------------------------------------------------------------------- /packages/env-var/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["."], 4 | "exclude": ["dist", "build", "node_modules"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/env-var/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"], 7 | "allowJs": true 8 | }, 9 | "include": ["**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /packages/exceptions-axios/.npmignore: -------------------------------------------------------------------------------- 1 | **/*.test.js 2 | -------------------------------------------------------------------------------- /packages/exceptions-axios/jest.config.js: -------------------------------------------------------------------------------- 1 | const global = require('../../jest.config'); 2 | 3 | module.exports = { 4 | ...global, 5 | displayName: 'exceptions-axios', 6 | coverageDirectory: '../../coverage/exceptions-axios', 7 | }; 8 | -------------------------------------------------------------------------------- /packages/exceptions-axios/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@availity/exceptions-axios", 3 | "version": "6.0.0", 4 | "description": "Availity class to log exceptions via axios", 5 | "license": "MIT", 6 | "author": "Evan Sharp ", 7 | "browser": "./dist/index.js", 8 | "main": "./dist/index.js", 9 | "module": "./dist/index.mjs", 10 | "types": "./dist/index.d.ts", 11 | "exports": { 12 | "./package.json": "./package.json", 13 | ".": { 14 | "types": "./dist/index.d.ts", 15 | "import": "./dist/index.mjs", 16 | "require": "./dist/index.js" 17 | } 18 | }, 19 | "engines": { 20 | "node": "^20.0.0 || ^22.0.0" 21 | }, 22 | "scripts": { 23 | "build": "tsup src/index.js --format esm,cjs --dts", 24 | "dev": "tsup src/index.js --format esm,cjs --watch --dts", 25 | "lint": "eslint src", 26 | "lint:fix": "eslint src --fix", 27 | "clean": "rm -rf node_modules && rm -rf dist", 28 | "publish": "yarn npm publish --tolerate-republish --access public" 29 | }, 30 | "dependencies": { 31 | "@availity/api-axios": "workspace:*", 32 | "@availity/exceptions-core": "workspace:*" 33 | }, 34 | "devDependencies": { 35 | "tsup": "^8.4.0", 36 | "typescript": "^5.5.4" 37 | }, 38 | "publishConfig": { 39 | "access": "public" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /packages/exceptions-axios/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "exceptions-axios", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "projectType": "library", 5 | "targets": { 6 | "test": { 7 | "executor": "@nx/jest:jest", 8 | "outputs": ["{workspaceRoot}/coverage/exceptions-axios"], 9 | "options": { 10 | "jestConfig": "packages/exceptions-axios/jest.config.js" 11 | } 12 | }, 13 | "version": { 14 | "executor": "@jscutlery/semver:version", 15 | "options": { 16 | "preset": "angular", 17 | "commitMessageFormat": "chore({projectName}): release version ${version} [skip ci]", 18 | "tagPrefix": "@availity/{projectName}@", 19 | "baseBranch": "master", 20 | "trackDeps": true 21 | } 22 | }, 23 | "lint": { 24 | "executor": "@nx/eslint:lint", 25 | "options": { 26 | "eslintConfig": ".eslintrc.yaml", 27 | "silent": false, 28 | "fix": false, 29 | "cache": true, 30 | "cacheLocation": "./node_modules/.cache/exceptions-axios/.eslintcache", 31 | "maxWarnings": -1, 32 | "quiet": false, 33 | "noEslintrc": false, 34 | "hasTypeAwareRules": true, 35 | "cacheStrategy": "metadata" 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/exceptions-axios/src/index.d.ts: -------------------------------------------------------------------------------- 1 | import AvExceptionsCore from '@availity/exceptions-core'; 2 | 3 | declare const avExceptionsAxios: AvExceptionsCore; 4 | 5 | export default avExceptionsAxios; 6 | -------------------------------------------------------------------------------- /packages/exceptions-axios/src/index.js: -------------------------------------------------------------------------------- 1 | import { avLogMessagesApi } from '@availity/api-axios'; 2 | 3 | import AvExceptionsCore from '@availity/exceptions-core'; 4 | 5 | const avExceptionsAxios = new AvExceptionsCore(avLogMessagesApi.error); 6 | 7 | export default avExceptionsAxios; 8 | -------------------------------------------------------------------------------- /packages/exceptions-axios/src/index.test.js: -------------------------------------------------------------------------------- 1 | import AvExceptionsCore from '@availity/exceptions-core'; 2 | import { avLogMessagesApi } from '@availity/api-axios'; 3 | 4 | import avExceptionsAxios from '.'; 5 | 6 | describe('AvExceptionsAxios', () => { 7 | test('avExceptionsAxios be an instance of AvExceptionsCore', () => { 8 | expect(avExceptionsAxios).toBeInstanceOf(AvExceptionsCore); 9 | }); 10 | 11 | test('avExceptionsAxios should be api-axios avLogMessagesApi error function', () => { 12 | expect(avExceptionsAxios.log).toBe(avLogMessagesApi.error); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /packages/exceptions-axios/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["."], 4 | "exclude": ["dist", "build", "node_modules"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/exceptions-axios/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"], 7 | "allowJs": true 8 | }, 9 | "include": ["**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /packages/exceptions-core/.npmignore: -------------------------------------------------------------------------------- 1 | **/*.test.js 2 | -------------------------------------------------------------------------------- /packages/exceptions-core/README.md: -------------------------------------------------------------------------------- 1 | # @availity/exceptions-core 2 | 3 | > A package to catch errors in apps and logs a formatted stack trace. 4 | 5 | [![Version](https://img.shields.io/npm/v/@availity/exceptions-core.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/exceptions-core) 6 | [![NPM Downloads](https://img.shields.io/npm/dt/@availity/exceptions-core.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/exceptions-core) 7 | [![Dependecy Status](https://img.shields.io/librariesio/release/npm/@availity/exceptions-core?style=for-the-badge)](https://github.com/Availity/sdk-js/blob/master/packages/exceptions-core/package.json) 8 | 9 | ## Install 10 | 11 | ### NPM 12 | 13 | ```bash 14 | npm install @availity/exceptions-core 15 | ``` 16 | 17 | ### Yarn 18 | 19 | ```bash 20 | yarn add @availity/exceptions-core 21 | ``` 22 | 23 | ## Documentation 24 | 25 | Check out more documentation at [availity.github.io](https://availity.github.io/sdk-js/resources/exceptions) 26 | -------------------------------------------------------------------------------- /packages/exceptions-core/jest.config.js: -------------------------------------------------------------------------------- 1 | const global = require('../../jest.config'); 2 | 3 | module.exports = { 4 | ...global, 5 | displayName: 'exceptions-core', 6 | coverageDirectory: '../../coverage/exceptions-core', 7 | }; 8 | -------------------------------------------------------------------------------- /packages/exceptions-core/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@availity/exceptions-core", 3 | "version": "6.0.0", 4 | "description": "Availity class to log exceptions", 5 | "license": "MIT", 6 | "author": "Kasey Powers ", 7 | "browser": "./dist/index.js", 8 | "main": "./dist/index.js", 9 | "module": "./dist/index.mjs", 10 | "types": "./dist/index.d.ts", 11 | "exports": { 12 | "./package.json": "./package.json", 13 | ".": { 14 | "types": "./dist/index.d.ts", 15 | "import": "./dist/index.mjs", 16 | "require": "./dist/index.js" 17 | } 18 | }, 19 | "engines": { 20 | "node": "^20.0.0 || ^22.0.0" 21 | }, 22 | "scripts": { 23 | "build": "tsup src/index.js --format esm,cjs --dts", 24 | "dev": "tsup src/index.js --format esm,cjs --watch --dts", 25 | "lint": "eslint src", 26 | "lint:fix": "eslint src --fix", 27 | "clean": "rm -rf node_modules && rm -rf dist", 28 | "publish": "yarn npm publish --tolerate-republish --access public" 29 | }, 30 | "devDependencies": { 31 | "mockdate": "^3.0.5", 32 | "stacktrace-js": "^2.0.2", 33 | "tsup": "^8.4.0", 34 | "typescript": "^5.5.4" 35 | }, 36 | "peerDependencies": { 37 | "stacktrace-js": "^2.0.2" 38 | }, 39 | "publishConfig": { 40 | "access": "public" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /packages/exceptions-core/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "exceptions-core", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "projectType": "library", 5 | "targets": { 6 | "test": { 7 | "executor": "@nx/jest:jest", 8 | "outputs": ["{workspaceRoot}/coverage/exceptions-core"], 9 | "options": { 10 | "jestConfig": "packages/exceptions-core/jest.config.js" 11 | } 12 | }, 13 | "version": { 14 | "executor": "@jscutlery/semver:version", 15 | "options": { 16 | "preset": "angular", 17 | "commitMessageFormat": "chore({projectName}): release version ${version} [skip ci]", 18 | "tagPrefix": "@availity/{projectName}@", 19 | "baseBranch": "master", 20 | "trackDeps": true 21 | } 22 | }, 23 | "lint": { 24 | "executor": "@nx/eslint:lint", 25 | "options": { 26 | "eslintConfig": ".eslintrc.yaml", 27 | "silent": false, 28 | "fix": false, 29 | "cache": true, 30 | "cacheLocation": "./node_modules/.cache/exceptions-core/.eslintcache", 31 | "maxWarnings": -1, 32 | "quiet": false, 33 | "noEslintrc": false, 34 | "hasTypeAwareRules": true, 35 | "cacheStrategy": "metadata" 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/exceptions-core/src/index.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-explicit-any */ 2 | declare class AvExceptions { 3 | constructor(log: (message: string) => void); 4 | 5 | submitError(error: any): void; 6 | 7 | onReport(errorReport: any): void; 8 | 9 | enabled(value: any, ...args: any[]): boolean; 10 | 11 | appId(id: any): string | number; 12 | 13 | repeatTime(time: any): number; 14 | 15 | prettyPrint(stackFrames: any): any; 16 | 17 | isRepeatError(exception: any): any; 18 | 19 | repeatTimer(message: any): void; 20 | 21 | onError(exception: any, skipRepeat?: boolean): Promise; 22 | 23 | isBlacklisted(exceptoin: any): any; 24 | } 25 | 26 | export default AvExceptions; 27 | -------------------------------------------------------------------------------- /packages/exceptions-core/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["."], 4 | "exclude": ["dist", "build", "node_modules"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/exceptions-core/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"], 7 | "allowJs": true 8 | }, 9 | "include": ["**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /packages/message-core/.npmignore: -------------------------------------------------------------------------------- 1 | **/*.test.js 2 | -------------------------------------------------------------------------------- /packages/message-core/README.md: -------------------------------------------------------------------------------- 1 | # @availity/message-core 2 | 3 | > A package wrapping the postMessage function with helper functions and security checks. 4 | 5 | [![Version](https://img.shields.io/npm/v/@availity/message-core.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/message-core) 6 | [![NPM Downloads](https://img.shields.io/npm/dt/@availity/message-core.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/message-core) 7 | [![Dependecy Status](https://img.shields.io/librariesio/release/npm/@availity/message-core?style=for-the-badge)](https://github.com/Availity/sdk-js/blob/master/packages/message-core/package.json) 8 | 9 | ## Install 10 | 11 | ### NPM 12 | 13 | ```bash 14 | npm install @availity/message-core 15 | ``` 16 | 17 | ### Yarn 18 | 19 | ```bash 20 | yarn add @availity/message-core 21 | ``` 22 | 23 | ## Documentation 24 | 25 | Check out more documentation at [availity.github.io](https://availity.github.io/sdk-js/resources/messaging) 26 | -------------------------------------------------------------------------------- /packages/message-core/jest.config.js: -------------------------------------------------------------------------------- 1 | const global = require('../../jest.config'); 2 | 3 | module.exports = { 4 | ...global, 5 | testURL: 'https://dev.local:9999', 6 | displayName: 'message-core', 7 | coverageDirectory: '../../coverage/message-core', 8 | }; 9 | -------------------------------------------------------------------------------- /packages/message-core/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@availity/message-core", 3 | "version": "8.0.0", 4 | "description": "availity wrapper for postMessage logic", 5 | "keywords": [ 6 | "availity", 7 | "message" 8 | ], 9 | "homepage": "https://availity.github.io/sdk-js/resources/messaging", 10 | "bugs": { 11 | "url": "https://github.com/availity/sdk-js/issues" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "git+https://github.com/availity/sdk-js.git", 16 | "directory": "packages/message-core" 17 | }, 18 | "license": "MIT", 19 | "author": "Kasey Powers ", 20 | "browser": "./dist/index.js", 21 | "main": "./dist/index.js", 22 | "module": "./dist/index.mjs", 23 | "types": "./dist/index.d.ts", 24 | "exports": { 25 | "./package.json": "./package.json", 26 | ".": { 27 | "types": "./dist/index.d.ts", 28 | "import": "./dist/index.mjs", 29 | "require": "./dist/index.js" 30 | } 31 | }, 32 | "engines": { 33 | "node": "^20.0.0 || ^22.0.0" 34 | }, 35 | "scripts": { 36 | "build": "tsup src/index.js --format esm,cjs --dts", 37 | "dev": "tsup src/index.js --format esm,cjs --watch --dts", 38 | "lint": "eslint src", 39 | "lint:fix": "eslint src --fix", 40 | "clean": "rm -rf node_modules && rm -rf dist", 41 | "publish": "yarn npm publish --tolerate-republish --access public" 42 | }, 43 | "devDependencies": { 44 | "tsup": "^8.4.0", 45 | "typescript": "^5.5.4" 46 | }, 47 | "publishConfig": { 48 | "access": "public" 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /packages/message-core/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "message-core", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "projectType": "library", 5 | "targets": { 6 | "test": { 7 | "executor": "@nx/jest:jest", 8 | "outputs": ["{workspaceRoot}/coverage/message-core"], 9 | "options": { 10 | "jestConfig": "packages/message-core/jest.config.js" 11 | } 12 | }, 13 | "version": { 14 | "executor": "@jscutlery/semver:version", 15 | "options": { 16 | "preset": "angular", 17 | "commitMessageFormat": "chore({projectName}): release version ${version} [skip ci]", 18 | "tagPrefix": "@availity/{projectName}@", 19 | "baseBranch": "master", 20 | "trackDeps": true 21 | } 22 | }, 23 | "lint": { 24 | "executor": "@nx/eslint:lint", 25 | "options": { 26 | "eslintConfig": ".eslintrc.yaml", 27 | "silent": false, 28 | "fix": false, 29 | "cache": true, 30 | "cacheLocation": "./node_modules/.cache/message-core/.eslintcache", 31 | "maxWarnings": -1, 32 | "quiet": false, 33 | "noEslintrc": false, 34 | "hasTypeAwareRules": true, 35 | "cacheStrategy": "metadata" 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/message-core/src/AvMessage.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-explicit-any */ 2 | declare class AvMessage { 3 | // eslint-disable-next-line @typescript-eslint/ban-types 4 | public subscribers: object; 5 | 6 | public enabled: (value?: boolean) => boolean; 7 | 8 | public subscribe: ( 9 | eventName?: string, 10 | fn: (data?: any) => void, 11 | options?: { ignoreSameWindow?: boolean } 12 | ) => () => void; 13 | 14 | public unsubscribe: (eventName?: string) => void; 15 | 16 | public unsubscribeAll: () => void; 17 | 18 | public send: (payload: any, target?: Window) => void; 19 | 20 | private getEventData: (eventData?: any) => void; 21 | 22 | private isDomain: (url: string) => boolean; 23 | 24 | private domain: () => string; 25 | } 26 | 27 | export default AvMessage; 28 | -------------------------------------------------------------------------------- /packages/message-core/src/index.d.ts: -------------------------------------------------------------------------------- 1 | import AvMessage from './AvMessage'; 2 | 3 | declare const AvMessageApi: AvMessage; 4 | 5 | export default AvMessageApi; 6 | -------------------------------------------------------------------------------- /packages/message-core/src/index.js: -------------------------------------------------------------------------------- 1 | import AvMessage from './AvMessage'; 2 | 3 | export default new AvMessage(); 4 | -------------------------------------------------------------------------------- /packages/message-core/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["."], 4 | "exclude": ["dist", "build", "node_modules"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/message-core/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"], 7 | "allowJs": true 8 | }, 9 | "include": ["**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /packages/native-form/.npmignore: -------------------------------------------------------------------------------- 1 | **/*.test.js 2 | -------------------------------------------------------------------------------- /packages/native-form/README.md: -------------------------------------------------------------------------------- 1 | # @availity/native-form 2 | 3 | > Submit JSON data via a native form, not AJAX. Useful when you need to open a new page with a POST action. 4 | 5 | [![Version](https://img.shields.io/npm/v/@availity/native-form.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/native-form) 6 | [![NPM Downloads](https://img.shields.io/npm/dt/@availity/native-form.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/native-form) 7 | [![Dependecy Status](https://img.shields.io/librariesio/release/npm/@availity/native-form?style=for-the-badge)](https://github.com/Availity/sdk-js/blob/master/packages/native-form/package.json) 8 | 9 | ## Install 10 | 11 | ### NPM 12 | 13 | ```bash 14 | npm install @availity/native-form 15 | ``` 16 | 17 | ### Yarn 18 | 19 | ```bash 20 | yarn add @availity/native-form 21 | ``` 22 | 23 | ## Documentation 24 | 25 | Check out more documentation at [availity.github.io](https://availity.github.io/sdk-js/resources/native-form) 26 | -------------------------------------------------------------------------------- /packages/native-form/jest.config.js: -------------------------------------------------------------------------------- 1 | const global = require('../../jest.config'); 2 | 3 | module.exports = { 4 | ...global, 5 | displayName: 'native-form', 6 | coverageDirectory: '../../coverage/native-form', 7 | }; 8 | -------------------------------------------------------------------------------- /packages/native-form/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "native-form", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "projectType": "library", 5 | "targets": { 6 | "test": { 7 | "executor": "@nx/jest:jest", 8 | "outputs": ["{workspaceRoot}/coverage/native-form"], 9 | "options": { 10 | "jestConfig": "packages/native-form/jest.config.js" 11 | } 12 | }, 13 | "version": { 14 | "executor": "@jscutlery/semver:version", 15 | "options": { 16 | "preset": "angular", 17 | "commitMessageFormat": "chore({projectName}): release version ${version} [skip ci]", 18 | "tagPrefix": "@availity/{projectName}@", 19 | "baseBranch": "master", 20 | "trackDeps": true 21 | } 22 | }, 23 | "lint": { 24 | "executor": "@nx/eslint:lint", 25 | "options": { 26 | "eslintConfig": ".eslintrc.yaml", 27 | "silent": false, 28 | "fix": false, 29 | "cache": true, 30 | "cacheLocation": "./node_modules/.cache/native-form/.eslintcache", 31 | "maxWarnings": -1, 32 | "quiet": false, 33 | "noEslintrc": false, 34 | "hasTypeAwareRules": true, 35 | "cacheStrategy": "metadata" 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/native-form/src/flattenObject.js: -------------------------------------------------------------------------------- 1 | // Copied from https://github.com/Availity/sdk-js/blob/master/packages/native-form/flattenObject.js 2 | const parseValue = (value) => (value === undefined || value === null ? value : value.toString()); 3 | 4 | const flattenObject = (ob) => 5 | Object.keys(ob).reduce((toReturn, k) => { 6 | if (Object.prototype.toString.call(ob[k]) === '[object Date]') { 7 | toReturn[k] = ob[k].toJSON(); 8 | } else if (ob[k] && typeof ob[k] === 'object') { 9 | const flatObject = flattenObject(ob[k]); 10 | const isArray = Array.isArray(ob[k]); 11 | 12 | for (const k2 of Object.keys(flatObject)) { 13 | toReturn[`${k}${isArray ? k2.replace(/^(\d+)(\..*)?/, '[$1]$2') : `.${k2}`}`] = parseValue(flatObject[k2]); 14 | } 15 | } else { 16 | toReturn[k] = parseValue(ob[k]); 17 | } 18 | 19 | return toReturn; 20 | }, {}); 21 | 22 | export default flattenObject; 23 | -------------------------------------------------------------------------------- /packages/native-form/src/index.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-explicit-any */ 2 | 3 | type SsoType = 'saml' | 'openid'; 4 | 5 | declare function nativeForm( 6 | spaceId: string, 7 | params?: Record, 8 | formAttributes?: Record, 9 | type?: SsoType, 10 | clientId?: string 11 | ): Promise; 12 | 13 | export default nativeForm; 14 | -------------------------------------------------------------------------------- /packages/native-form/src/tests/flattenObject.test.js: -------------------------------------------------------------------------------- 1 | import flattenObject from '../flattenObject'; 2 | 3 | describe('flattenObject', () => { 4 | test('should flatten', () => { 5 | const obj = { 6 | int: 123, 7 | obj: { 8 | string: 'string', 9 | }, 10 | }; 11 | 12 | const flatObj = flattenObject(obj); 13 | expect(flatObj.int).toBe('123'); 14 | expect(flatObj['obj.string']).toBe('string'); 15 | }); 16 | 17 | test('handles undefined', () => { 18 | const obj = { 19 | int: 0, 20 | false: false, 21 | undefined, 22 | obj: { 23 | int: 123, 24 | string: 'string', 25 | }, 26 | }; 27 | 28 | const flatObj = flattenObject(obj); 29 | expect(flatObj.int).toBe('0'); 30 | expect(flatObj.false).toBe('false'); 31 | expect(flatObj['obj.string']).toBe('string'); 32 | expect(flatObj.undefined).toBeUndefined(); 33 | }); 34 | }); 35 | -------------------------------------------------------------------------------- /packages/native-form/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["."], 4 | "exclude": ["dist", "build", "node_modules"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/native-form/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"], 7 | "allowJs": true 8 | }, 9 | "include": ["**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /packages/relay-id/.npmignore: -------------------------------------------------------------------------------- 1 | **/*.test.js 2 | -------------------------------------------------------------------------------- /packages/relay-id/README.md: -------------------------------------------------------------------------------- 1 | # @availity/relay-id 2 | 3 | > Small package containing helpers for encoding/decoding ids according to the relay specification 4 | 5 | [![Version](https://img.shields.io/npm/v/@availity/relay-id.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/relay-id) 6 | [![NPM Downloads](https://img.shields.io/npm/dt/@availity/relay-id.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/relay-id) 7 | [![Dependecy Status](https://img.shields.io/librariesio/release/npm/@availity/relay-id?style=for-the-badge)](https://github.com/Availity/sdk-js/blob/master/packages/relay-id/package.json) 8 | 9 | ## Install 10 | 11 | ### NPM 12 | 13 | ```bash 14 | npm install @availity/relay-id 15 | ``` 16 | 17 | ### Yarn 18 | 19 | ```bash 20 | yarn add @availity/relay-id 21 | ``` 22 | 23 | ## Documentation 24 | 25 | Check out more documentation at [availity.github.io](https://availity.github.io/sdk-js/resources/relay-id) 26 | -------------------------------------------------------------------------------- /packages/relay-id/jest.config.js: -------------------------------------------------------------------------------- 1 | const global = require('../../jest.config'); 2 | 3 | module.exports = { 4 | ...global, 5 | displayName: 'relay-id', 6 | coverageDirectory: '../../coverage/relay-id', 7 | }; 8 | -------------------------------------------------------------------------------- /packages/relay-id/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "relay-id", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "projectType": "library", 5 | "targets": { 6 | "test": { 7 | "executor": "@nx/jest:jest", 8 | "outputs": ["{workspaceRoot}/coverage/relay-id"], 9 | "options": { 10 | "jestConfig": "packages/relay-id/jest.config.js" 11 | } 12 | }, 13 | "version": { 14 | "executor": "@jscutlery/semver:version", 15 | "options": { 16 | "preset": "angular", 17 | "commitMessageFormat": "chore({projectName}): release version ${version} [skip ci]", 18 | "tagPrefix": "@availity/{projectName}@", 19 | "baseBranch": "master", 20 | "trackDeps": true 21 | } 22 | }, 23 | "lint": { 24 | "executor": "@nx/eslint:lint", 25 | "options": { 26 | "eslintConfig": ".eslintrc.yaml", 27 | "silent": false, 28 | "fix": false, 29 | "cache": true, 30 | "cacheLocation": "./node_modules/.cache/relay-id/.eslintcache", 31 | "maxWarnings": -1, 32 | "quiet": false, 33 | "noEslintrc": false, 34 | "hasTypeAwareRules": true, 35 | "cacheStrategy": "metadata" 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/relay-id/src/index.d.ts: -------------------------------------------------------------------------------- 1 | export type ResolvedGlobalId = { 2 | type: string; 3 | id: string; 4 | }; 5 | 6 | declare function base64(decodedString: string): string; 7 | declare function unbase64(encodedString: string): string; 8 | declare function toGlobalId(type: string, id: string): string; 9 | declare function fromGlobalId(globalId: string): ResolvedGlobalId; 10 | 11 | export { base64, unbase64, toGlobalId, fromGlobalId }; 12 | -------------------------------------------------------------------------------- /packages/relay-id/src/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Inspired By https://github.com/graphql-compose/graphql-compose-relay/blob/master/src/globalId.js 3 | */ 4 | 5 | export function base64(i) { 6 | return btoa(i); 7 | } 8 | 9 | export function unbase64(i) { 10 | return atob(i); 11 | } 12 | 13 | /** 14 | * Takes a type name and an ID specific to that type name, and returns a 15 | * "global ID" that is unique among all types. 16 | */ 17 | export function toGlobalId(type, id) { 18 | return base64([type, id].join(':')); 19 | } 20 | 21 | /** 22 | * Takes the "global ID" created by toGlobalID, and returns the type name and ID 23 | * used to create it. test change 24 | */ 25 | export function fromGlobalId(globalId) { 26 | const unbasedGlobalId = unbase64(globalId); 27 | const delimiterPos = unbasedGlobalId.indexOf(':'); 28 | return { 29 | type: unbasedGlobalId.substring(0, delimiterPos), 30 | id: unbasedGlobalId.substring(delimiterPos + 1), 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /packages/relay-id/src/index.test.js: -------------------------------------------------------------------------------- 1 | import { base64, unbase64, toGlobalId, fromGlobalId } from '.'; 2 | 3 | describe('globalId', () => { 4 | it('should have correct method base64()', () => { 5 | expect(base64('123')).toBe('MTIz'); 6 | expect(base64('lksdnfkksdknsdc:123')).toBe('bGtzZG5ma2tzZGtuc2RjOjEyMw=='); 7 | }); 8 | 9 | it('should have correct method unbase64()', () => { 10 | expect(unbase64('MTIz')).toBe('123'); 11 | expect(unbase64('bGtzZG5ma2tzZGtuc2RjOjEyMw==')).toBe('lksdnfkksdknsdc:123'); 12 | }); 13 | 14 | it('should have correct method toGlobalId()', () => { 15 | expect(toGlobalId('User', '789')).toBe('VXNlcjo3ODk='); 16 | expect(toGlobalId('Article', 22)).toBe('QXJ0aWNsZToyMg=='); 17 | }); 18 | 19 | it('should have correct method fromGlobalId()', () => { 20 | expect(fromGlobalId('VXNlcjo3ODk=')).toEqual({ 21 | type: 'User', 22 | id: '789', 23 | }); 24 | expect(fromGlobalId('QXJ0aWNsZToyMg==')).toEqual({ 25 | type: 'Article', 26 | id: '22', 27 | }); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /packages/relay-id/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["."], 4 | "exclude": ["dist", "build", "node_modules"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/relay-id/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"], 7 | "allowJs": true 8 | }, 9 | "include": ["**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /packages/resolve-url/.npmignore: -------------------------------------------------------------------------------- 1 | **/*.test.js 2 | -------------------------------------------------------------------------------- /packages/resolve-url/README.md: -------------------------------------------------------------------------------- 1 | # @availity/resolve-url 2 | 3 | > Resolve URLs to absolute URI/IRI. 4 | 5 | [![Version](https://img.shields.io/npm/v/@availity/resolve-url.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/resolve-url) 6 | [![NPM Downloads](https://img.shields.io/npm/dt/@availity/resolve-url.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/resolve-url) 7 | [![Dependecy Status](https://img.shields.io/librariesio/release/npm/@availity/resolve-url?style=for-the-badge)](https://github.com/Availity/sdk-js/blob/master/packages/resolve-url/package.json) 8 | 9 | This library resolves relative IRIs to absolute IRIs given a base IRI, conforming to [RFC3986](https://www.ietf.org/rfc/rfc3986.txt). The code was borrowed from [relative-to-absolute-iri 10 | ](https://github.com/rubensorks/relative-to-absolute-iri.js). ~There is an open issue to make the library compatible with IE11: [Issue #5](https://github.com/rubensworks/relative-to-absolute-iri.js/issues/5)~ 11 | 12 | ## Installation 13 | 14 | ### NPM 15 | 16 | ```bash 17 | npm install @availity/resolve-url 18 | ``` 19 | 20 | ### Yarn 21 | 22 | ```bash 23 | yarn add @availity/resolve-url 24 | ``` 25 | 26 | ## Documentation 27 | 28 | Check out more documentation at [availity.github.io](https://availity.github.io/sdk-js/resources/resolve-url) 29 | -------------------------------------------------------------------------------- /packages/resolve-url/jest.config.js: -------------------------------------------------------------------------------- 1 | const global = require('../../jest.config'); 2 | 3 | module.exports = { 4 | ...global, 5 | displayName: 'resolve-url', 6 | coverageDirectory: '../../coverage/resolve-url', 7 | }; 8 | -------------------------------------------------------------------------------- /packages/resolve-url/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@availity/resolve-url", 3 | "version": "4.0.0", 4 | "description": "Resolve absolute url from relative urls", 5 | "keywords": [ 6 | "availity", 7 | "url", 8 | "relative" 9 | ], 10 | "homepage": "https://availity.github.io/sdk-js/resources/resolve-url", 11 | "bugs": { 12 | "url": "https://github.com/availity/sdk-js/issues" 13 | }, 14 | "repository": { 15 | "type": "git", 16 | "url": "git+https://github.com/availity/sdk-js.git", 17 | "directory": "packages/resolve-url" 18 | }, 19 | "license": "MIT", 20 | "author": "Rob McGuinness ", 21 | "browser": "./dist/index.js", 22 | "main": "./dist/index.js", 23 | "module": "./dist/index.mjs", 24 | "types": "./dist/index.d.ts", 25 | "exports": { 26 | "./package.json": "./package.json", 27 | ".": { 28 | "types": "./dist/index.d.ts", 29 | "import": "./dist/index.mjs", 30 | "require": "./dist/index.js" 31 | } 32 | }, 33 | "engines": { 34 | "node": "^20.0.0 || ^22.0.0" 35 | }, 36 | "scripts": { 37 | "build": "tsup src/index.js --format esm,cjs --dts", 38 | "dev": "tsup src/index.js --format esm,cjs --watch --dts", 39 | "lint": "eslint src", 40 | "lint:fix": "eslint src --fix", 41 | "clean": "rm -rf node_modules && rm -rf dist", 42 | "publish": "yarn npm publish --tolerate-republish --access public" 43 | }, 44 | "devDependencies": { 45 | "tsup": "^8.4.0", 46 | "typescript": "^5.5.4" 47 | }, 48 | "publishConfig": { 49 | "access": "public" 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /packages/resolve-url/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "resolve-url", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "projectType": "library", 5 | "targets": { 6 | "test": { 7 | "executor": "@nx/jest:jest", 8 | "outputs": ["{workspaceRoot}/coverage/resolve-url"], 9 | "options": { 10 | "jestConfig": "packages/resolve-url/jest.config.js" 11 | } 12 | }, 13 | "version": { 14 | "executor": "@jscutlery/semver:version", 15 | "options": { 16 | "preset": "angular", 17 | "commitMessageFormat": "chore({projectName}): release version ${version} [skip ci]", 18 | "tagPrefix": "@availity/{projectName}@", 19 | "baseBranch": "master", 20 | "trackDeps": true 21 | } 22 | }, 23 | "lint": { 24 | "executor": "@nx/eslint:lint", 25 | "options": { 26 | "eslintConfig": ".eslintrc.yaml", 27 | "silent": false, 28 | "fix": false, 29 | "cache": true, 30 | "cacheLocation": "./node_modules/.cache/resolve-url/.eslintcache", 31 | "maxWarnings": -1, 32 | "quiet": false, 33 | "noEslintrc": false, 34 | "hasTypeAwareRules": true, 35 | "cacheStrategy": "metadata" 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/resolve-url/src/index.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable unicorn/prefer-export-from */ 2 | import resolveUrl from './resolve-url'; 3 | import isAbsoluteUrl from './is-absolute-url'; 4 | import { resolve as relativeToAbsolute } from './relative-to-absolute'; 5 | 6 | export default resolveUrl; 7 | 8 | export { isAbsoluteUrl, relativeToAbsolute }; 9 | -------------------------------------------------------------------------------- /packages/resolve-url/src/index.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable unicorn/prefer-export-from */ 2 | import resolveUrl from './resolve-url'; 3 | import isAbsoluteUrl from './is-absolute-url'; 4 | import { resolve as relativeToAbsolute } from './relative-to-absolute'; 5 | 6 | export default resolveUrl; 7 | 8 | export { isAbsoluteUrl, relativeToAbsolute }; 9 | -------------------------------------------------------------------------------- /packages/resolve-url/src/is-absolute-url.d.ts: -------------------------------------------------------------------------------- 1 | declare function isAbsoluteUrl(url: string): boolean; 2 | 3 | export default isAbsoluteUrl; 4 | -------------------------------------------------------------------------------- /packages/resolve-url/src/is-absolute-url.js: -------------------------------------------------------------------------------- 1 | // Borrowed from https://github.com/sindresorhus/is-absolute-url to make IE11 compatible 2 | const isAbsoluteUrl = (url) => { 3 | if (typeof url !== 'string') { 4 | throw new TypeError(`Expected a \`string\`, got \`${typeof url}\``); 5 | } 6 | 7 | // eslint-disable-next-line unicorn/better-regex 8 | return /^[a-z][a-z\d+.-]*:/.test(url); 9 | }; 10 | 11 | export default isAbsoluteUrl; 12 | -------------------------------------------------------------------------------- /packages/resolve-url/src/relative-to-absolute.d.ts: -------------------------------------------------------------------------------- 1 | declare function removeDotSegments(path: string): string; 2 | declare function removeDotSegmentsOfPath(iri: string, colonPosition: number): string; 3 | declare function resolve(relativeIRI: string, baseIRI?: string): string; 4 | 5 | export { removeDotSegments, removeDotSegmentsOfPath, resolve }; 6 | -------------------------------------------------------------------------------- /packages/resolve-url/src/resolve-url.d.ts: -------------------------------------------------------------------------------- 1 | interface ResolveOptions { 2 | relative: string; 3 | base?: string; 4 | } 5 | 6 | declare function resolveUrl(opts: ResolveOptions): string; 7 | 8 | export default resolveUrl; 9 | -------------------------------------------------------------------------------- /packages/resolve-url/src/resolve-url.js: -------------------------------------------------------------------------------- 1 | import isAbsoluteUrl from './is-absolute-url'; 2 | import { resolve } from './relative-to-absolute'; 3 | 4 | const resolveUrl = ({ relative = '', base }) => { 5 | if (isAbsoluteUrl(relative)) { 6 | return relative; 7 | } 8 | 9 | if (!base) { 10 | const { origin } = window.location; 11 | base = `${origin}/`; 12 | } 13 | 14 | return resolve(relative, base); 15 | }; 16 | 17 | // eslint-disable-next-line unicorn/prefer-export-from 18 | export { isAbsoluteUrl }; 19 | export default resolveUrl; 20 | -------------------------------------------------------------------------------- /packages/resolve-url/src/tests/is-absolute-url.test.js: -------------------------------------------------------------------------------- 1 | // From https://github.com/sindresorhus/is-absolute-url/blob/master/test.js 2 | import isAbsoluteUrl from '../is-absolute-url'; 3 | 4 | describe('is-absolute-url', () => { 5 | it('should be absolute url', () => { 6 | expect(isAbsoluteUrl('http://sindresorhus.com')).toBeTruthy(); 7 | expect(isAbsoluteUrl('https://sindresorhus.com')).toBeTruthy(); 8 | expect(isAbsoluteUrl('file://sindresorhus.com')).toBeTruthy(); 9 | expect(isAbsoluteUrl('mailto:someone@example.com')).toBeTruthy(); 10 | expect(isAbsoluteUrl('data:text/plain;base64,SGVsbG8sIFdvcmxkIQ%3D%3D')).toBeTruthy(); 11 | }); 12 | 13 | it('should be relative url', () => { 14 | expect(isAbsoluteUrl('//sindresorhus.com')).toBeFalsy(); 15 | expect(isAbsoluteUrl('/foo/bar')).toBeFalsy(); 16 | expect(isAbsoluteUrl('foo/bar')).toBeFalsy(); 17 | expect(isAbsoluteUrl('foo')).toBeFalsy(); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /packages/resolve-url/src/tests/resolve-url.test.js: -------------------------------------------------------------------------------- 1 | import resolveUrl from '..'; 2 | 3 | describe('resolve-url', () => { 4 | beforeEach(() => { 5 | global.jsdom.reconfigure({ 6 | url: 'https://dev.local/', 7 | }); 8 | }); 9 | test('should resolve relative url', () => { 10 | const fullUrl = resolveUrl({ relative: '/a/b/c' }); 11 | expect(fullUrl).toBe(`https://dev.local/a/b/c`); 12 | }); 13 | 14 | test('should resolve absolute url', () => { 15 | const fullUrl = resolveUrl({ relative: 'https://dev.local/a/b/c' }); 16 | expect(fullUrl).toBe('https://dev.local/a/b/c'); 17 | }); 18 | test('should join urls with missing slash', () => { 19 | // missing forward slash in relative url 20 | let fullUrl = resolveUrl({ relative: 'a/b/c' }); 21 | expect(fullUrl).toBe('https://dev.local/a/b/c'); 22 | 23 | global.jsdom.reconfigure({ 24 | url: 'https://dev.local/other', 25 | }); 26 | 27 | // missing forward slash in base url 28 | fullUrl = resolveUrl({ relative: '/a/b/c' }); 29 | expect(fullUrl).toBe('https://dev.local/a/b/c'); 30 | 31 | global.jsdom.reconfigure({ 32 | url: 'https://dev.local/other/', 33 | }); 34 | 35 | // missing forward slash in relative and base url 36 | fullUrl = resolveUrl({ relative: 'a/b/c' }); 37 | expect(fullUrl).toBe('https://dev.local/a/b/c'); 38 | }); 39 | }); 40 | -------------------------------------------------------------------------------- /packages/resolve-url/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["."], 4 | "exclude": ["dist", "build", "node_modules"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/resolve-url/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"], 7 | "allowJs": true 8 | }, 9 | "include": ["**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /packages/upload-core/.npmignore: -------------------------------------------------------------------------------- 1 | **/*.test.js 2 | -------------------------------------------------------------------------------- /packages/upload-core/README.md: -------------------------------------------------------------------------------- 1 | # @availity/upload-core 2 | 3 | > Wrapper for tus-js-client 4 | 5 | [![Version](https://img.shields.io/npm/v/@availity/upload-core.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/upload-core) 6 | [![NPM Downloads](https://img.shields.io/npm/dt/@availity/upload-core.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/upload-core) 7 | [![Dependecy Status](https://img.shields.io/librariesio/release/npm/@availity/upload-core?style=for-the-badge)](https://github.com/Availity/sdk-js/blob/master/packages/upload-core/package.json) 8 | 9 | ## Install 10 | 11 | ### NPM 12 | 13 | ```bash 14 | npm install @availity/upload-core 15 | ``` 16 | 17 | ### Yarn 18 | 19 | ```bash 20 | yarn add @availity/upload-core 21 | ``` 22 | 23 | ## Documentation 24 | 25 | Check out more documentation at [availity.github.io](https://availity.github.io/sdk-js/api/uploads) 26 | -------------------------------------------------------------------------------- /packages/upload-core/jest.config.js: -------------------------------------------------------------------------------- 1 | const global = require('../../jest.config'); 2 | 3 | module.exports = { 4 | ...global, 5 | displayName: 'upload-core', 6 | coverageDirectory: '../../coverage/upload-core', 7 | coveragePathIgnorePatterns: ['/mocks/*'], 8 | }; 9 | -------------------------------------------------------------------------------- /packages/upload-core/mocks/server.ts: -------------------------------------------------------------------------------- 1 | // src/mocks/server.js 2 | import { setupServer } from 'msw/node'; 3 | import handlers from './handlers'; 4 | 5 | // This configures a request mocking server with the given request handlers. 6 | export const server = setupServer(...handlers); 7 | -------------------------------------------------------------------------------- /packages/upload-core/mocks/testFile.txt: -------------------------------------------------------------------------------- 1 | This is a file used for testing -------------------------------------------------------------------------------- /packages/upload-core/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "upload-core", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "projectType": "library", 5 | "targets": { 6 | "test": { 7 | "executor": "@nx/jest:jest", 8 | "outputs": ["{workspaceRoot}/coverage/upload-core"], 9 | "options": { 10 | "jestConfig": "packages/upload-core/jest.config.js" 11 | } 12 | }, 13 | "version": { 14 | "executor": "@jscutlery/semver:version", 15 | "options": { 16 | "preset": "angular", 17 | "commitMessageFormat": "chore({projectName}): release version ${version} [skip ci]", 18 | "tagPrefix": "@availity/{projectName}@", 19 | "baseBranch": "master", 20 | "trackDeps": true 21 | } 22 | }, 23 | "lint": { 24 | "executor": "@nx/eslint:lint", 25 | "options": { 26 | "eslintConfig": ".eslintrc.yaml", 27 | "silent": false, 28 | "fix": false, 29 | "cache": true, 30 | "cacheLocation": "./node_modules/.cache/upload-core/.eslintcache", 31 | "maxWarnings": -1, 32 | "quiet": false, 33 | "noEslintrc": false, 34 | "hasTypeAwareRules": true, 35 | "cacheStrategy": "metadata" 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/upload-core/src/util.test.ts: -------------------------------------------------------------------------------- 1 | import { createFingerprint, hashCode, isDetailedError } from './util'; 2 | 3 | describe('upload-core util', () => { 4 | test('hash code is generated', () => { 5 | expect(hashCode('abc123')).toBe(-1424436592); 6 | expect(hashCode('987zyx')).toBe(1685338401); 7 | }); 8 | 9 | test('return 0 if no value provided', () => { 10 | expect(hashCode('')).toBe(0); 11 | }); 12 | 13 | test('create fingerprint for file upload', async () => { 14 | const file = new File(['Hello world'], 'test'); 15 | 16 | const fingerprint = await createFingerprint(file, { endpoint: '/test', metadata: { foo: 'bar' } }); 17 | 18 | expect(fingerprint).toContain('tus-test-11-'); 19 | }); 20 | 21 | test('create fingerprint and call callback', async () => { 22 | const file = new File(['Hello world'], 'test'); 23 | const mockFn = jest.fn((...args) => args[1]); 24 | 25 | const fingerprint = await createFingerprint(file, { endpoint: '/test', metadata: { foo: 'bar' } }, mockFn); 26 | 27 | expect(fingerprint).toContain('tus-test-11-'); 28 | expect(mockFn).toHaveBeenCalledTimes(1); 29 | }); 30 | 31 | test('determine if an error is a detailed error', () => { 32 | expect(isDetailedError(new Error('test'))).toBeFalsy(); 33 | 34 | const detailedError = new Error('test'); 35 | // @ts-expect-error allow error for testing 36 | detailedError.originalResponse = {}; 37 | expect(isDetailedError(detailedError)).toBeTruthy(); 38 | }); 39 | }); 40 | -------------------------------------------------------------------------------- /packages/upload-core/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["."], 4 | "exclude": ["dist", "build", "node_modules"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/upload-core/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"], 7 | "allowJs": true 8 | }, 9 | "include": ["**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /packages/user-activity-broadcaster/README.md: -------------------------------------------------------------------------------- 1 | # @availity/user-activity-broadcaster 2 | 3 | > This package broadcasts user activity to the navigation. 4 | 5 | [![Version](https://img.shields.io/npm/v/@availity/user-activity-broadcaster.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/user-activity-broadcaster) 6 | [![NPM Downloads](https://img.shields.io/npm/dt/@availity/user-activity-broadcaster.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/user-activity-broadcaster) 7 | [![Dependecy Status](https://img.shields.io/librariesio/release/npm/@availity/user-activity-broadcaster?style=for-the-badge)](https://github.com/Availity/sdk-js/blob/master/packages/user-activity-broadcaster/package.json) 8 | 9 | ## Installation 10 | 11 | ### NPM 12 | 13 | ```bash 14 | npm install @availity/user-activity-broadcaster 15 | ``` 16 | 17 | ### Yarn 18 | 19 | ```bash 20 | yarn add @availity/user-activity-broadcaster 21 | ``` 22 | 23 | ## Usage 24 | 25 | > All you have to do is include this as a dependency and import it into the root of your web application. 26 | -------------------------------------------------------------------------------- /packages/user-activity-broadcaster/jest.config.js: -------------------------------------------------------------------------------- 1 | const global = require('../../jest.config'); 2 | 3 | module.exports = { 4 | ...global, 5 | displayName: 'user-activity-broadcaster', 6 | coverageDirectory: '../../coverage/user-activity-broadcaster', 7 | }; 8 | -------------------------------------------------------------------------------- /packages/user-activity-broadcaster/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@availity/user-activity-broadcaster", 3 | "version": "1.0.0", 4 | "description": "This package broacasts user activity to the navigation.", 5 | "main": "src/index.js", 6 | "keywords": [], 7 | "author": "Joe Spanbauer ", 8 | "exports": { 9 | "./package.json": "./package.json", 10 | ".": { 11 | "types": "./dist/index.d.ts", 12 | "import": "./dist/index.mjs", 13 | "require": "./dist/index.js" 14 | } 15 | }, 16 | "engines": { 17 | "node": "^20.0.0 || ^22.0.0" 18 | }, 19 | "scripts": { 20 | "build": "tsup src/index.js --format esm,cjs --dts", 21 | "dev": "tsup src/index.js --format esm,cjs --watch --dts", 22 | "lint": "eslint src", 23 | "lint:fix": "eslint src --fix", 24 | "clean": "rm -rf node_modules && rm -rf dist", 25 | "publish": "yarn npm publish --tolerate-republish --access public" 26 | }, 27 | "license": "MIT", 28 | "devDependencies": { 29 | "tsup": "^8.4.0" 30 | }, 31 | "publishConfig": { 32 | "access": "public" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /packages/user-activity-broadcaster/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "user-activity-broadcaster", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "projectType": "library", 5 | "targets": { 6 | "test": { 7 | "executor": "@nx/jest:jest", 8 | "outputs": ["{workspaceRoot}/coverage/resolve-url"], 9 | "options": { 10 | "jestConfig": "packages/user-activity-broadcaster/jest.config.js" 11 | } 12 | }, 13 | "version": { 14 | "executor": "@jscutlery/semver:version", 15 | "options": { 16 | "preset": "angular", 17 | "commitMessageFormat": "chore({projectName}): release version ${version} [skip ci]", 18 | "tagPrefix": "@availity/{projectName}@", 19 | "baseBranch": "master", 20 | "trackDeps": true 21 | } 22 | }, 23 | "lint": { 24 | "executor": "@nx/eslint:lint", 25 | "options": { 26 | "eslintConfig": ".eslintrc.yaml", 27 | "silent": false, 28 | "fix": false, 29 | "cache": true, 30 | "cacheLocation": "./node_modules/.cache/user-activity-broadcaster/.eslintcache", 31 | "maxWarnings": -1, 32 | "quiet": false, 33 | "noEslintrc": false, 34 | "hasTypeAwareRules": true, 35 | "cacheStrategy": "metadata" 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/user-activity-broadcaster/src/index.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable unicorn/no-empty-file */ 2 | -------------------------------------------------------------------------------- /packages/user-activity-broadcaster/src/index.js: -------------------------------------------------------------------------------- 1 | const MINUTE = 60 * 1000 2 | const interval = MINUTE * 5 3 | export const eventName = 'user_activity' 4 | 5 | // Must be a dynamic object to test this 6 | export const lastActivity = {} 7 | 8 | export const getTargetOrigin = (origin = window.location.origin) => { 9 | // Setup targetOrigin to alternate origin (because the same origin already works) 10 | if (origin) { 11 | if (origin.includes('apps')) { 12 | return origin.replace('apps', 'essentials') 13 | } 14 | 15 | if (origin.includes('essentials')) { 16 | return origin.replace('essentials', 'apps') 17 | } 18 | } 19 | 20 | return undefined 21 | } 22 | 23 | const targetOrigin = getTargetOrigin() 24 | 25 | // PostMessage Logic 26 | export const handleActivityUpdate = () => { 27 | window.top.postMessage({ 28 | event: eventName, 29 | time: lastActivity.time 30 | }, targetOrigin) 31 | } 32 | 33 | // Debounce Logic 34 | let activityIntervalId = setInterval(handleActivityUpdate, interval) 35 | // Re-assignable for testing 36 | export const updateInterval = (newInterval) => { 37 | clearInterval(activityIntervalId) 38 | activityIntervalId = setInterval(handleActivityUpdate, newInterval) 39 | } 40 | 41 | // Event Handlers 42 | export const handleActivity = () => { 43 | lastActivity.time = Date.now().toString() 44 | } 45 | 46 | // Add ability to test handleActivity and events 47 | export const addEventListeners = () => { 48 | document.addEventListener('mousedown', handleActivity) 49 | document.addEventListener('keydown', handleActivity) 50 | } 51 | addEventListeners() 52 | -------------------------------------------------------------------------------- /packages/user-activity-broadcaster/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["."], 4 | "exclude": ["dist", "build", "node_modules"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/user-activity-broadcaster/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"], 7 | "allowJs": true 8 | }, 9 | "include": ["**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /packages/yup/.npmignore: -------------------------------------------------------------------------------- 1 | **/*.test.ts 2 | -------------------------------------------------------------------------------- /packages/yup/README.md: -------------------------------------------------------------------------------- 1 | # @availity/yup 2 | 3 | > Method extensions for [yup](https://github.com/jquense/yup) 4 | 5 | [![Version](https://img.shields.io/npm/v/@availity/yup.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/yup) 6 | [![NPM Downloads](https://img.shields.io/npm/dt/@availity/yup.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/yup) 7 | [![Dependecy Status](https://img.shields.io/librariesio/release/npm/@availity/yup?style=for-the-badge)](https://github.com/Availity/sdk-js/blob/master/packages/yup/package.json) 8 | 9 | ## Install 10 | 11 | ### NPM 12 | 13 | ```bash 14 | npm install @availity/yup yup 15 | ``` 16 | 17 | ### Yarn 18 | 19 | ```bash 20 | yarn add @availity/yup yup 21 | ``` 22 | 23 | > You will need to also install [moment](https://www.npmjs.com/package/moment) if you plan on using the `date` or `dateRange` schemas 24 | 25 | ## Documentation 26 | 27 | Check out more documentation at [availity.github.io](https://availity.github.io/sdk-js/resources/yup) 28 | -------------------------------------------------------------------------------- /packages/yup/jest.config.js: -------------------------------------------------------------------------------- 1 | const global = require('../../jest.config'); 2 | 3 | module.exports = { 4 | ...global, 5 | displayName: 'yup', 6 | coverageDirectory: '../../coverage/yup', 7 | }; 8 | -------------------------------------------------------------------------------- /packages/yup/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "yup", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "projectType": "library", 5 | "targets": { 6 | "test": { 7 | "executor": "@nx/jest:jest", 8 | "outputs": ["{workspaceRoot}/coverage/yup"], 9 | "options": { 10 | "jestConfig": "packages/yup/jest.config.js" 11 | } 12 | }, 13 | "version": { 14 | "executor": "@jscutlery/semver:version", 15 | "options": { 16 | "preset": "angular", 17 | "commitMessageFormat": "chore({projectName}): release version ${version} [skip ci]", 18 | "tagPrefix": "@availity/{projectName}@", 19 | "baseBranch": "master", 20 | "trackDeps": true 21 | } 22 | }, 23 | "lint": { 24 | "executor": "@nx/eslint:lint", 25 | "options": { 26 | "eslintConfig": ".eslintrc.yaml", 27 | "silent": false, 28 | "fix": false, 29 | "cache": true, 30 | "cacheLocation": "./node_modules/.cache/yup/.eslintcache", 31 | "maxWarnings": -1, 32 | "quiet": false, 33 | "noEslintrc": false, 34 | "hasTypeAwareRules": true, 35 | "cacheStrategy": "metadata" 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/yup/src/isRequired.ts: -------------------------------------------------------------------------------- 1 | import { BaseSchema } from 'yup'; 2 | 3 | function isRequired(this: Schema, isRequired = true, msg?: string): Schema { 4 | return this.test({ 5 | name: 'isRequired', 6 | exclusive: true, 7 | message: msg || 'This field is required.', 8 | test(value) { 9 | if (isRequired) { 10 | // array and string have custom logic 11 | if (this.schema.type === 'array') { 12 | return Array.isArray(value) ? value.length > 0 : value !== undefined; 13 | } 14 | if (this.schema.type === 'string') { 15 | return value !== undefined && value !== ''; 16 | } 17 | // default logic for all other types 18 | return value !== undefined; 19 | } 20 | 21 | return true; 22 | }, 23 | }); 24 | } 25 | 26 | export default isRequired; 27 | -------------------------------------------------------------------------------- /packages/yup/src/npi.ts: -------------------------------------------------------------------------------- 1 | import { BaseSchema } from 'yup'; 2 | 3 | const INTEGER_REGEX = /^\d*$/; 4 | 5 | function npi(this: Schema, msg?: string): Schema { 6 | return this.test({ 7 | name: 'npi', 8 | exclusive: true, 9 | message: msg || 'This field is invalid.', 10 | test(value) { 11 | if (!value) return true; 12 | 13 | value += ''; 14 | 15 | // is it a number and 10 digits long 16 | if (!INTEGER_REGEX.test(value) || value.length !== 10) { 17 | return false; 18 | } 19 | 20 | // is the first digit 1-4 21 | const firstDigit = value.charAt(0); 22 | if (['1', '2', '3', '4'].indexOf(firstDigit) < 0) { 23 | return false; 24 | } 25 | 26 | const digit = Number.parseInt(value.charAt(9), 10); 27 | value = value.substring(0, 9); 28 | value = `80840${value}`; 29 | 30 | let alternate = true; 31 | let total = 0; 32 | 33 | for (let i = value.length; i > 0; i--) { 34 | let next = Number.parseInt(value.charAt(i - 1), 10); 35 | if (alternate) { 36 | next *= 2; 37 | if (next > 9) { 38 | next = (next % 10) + 1; 39 | } 40 | } 41 | total += next; 42 | alternate = !alternate; 43 | } 44 | 45 | const roundUp = Math.ceil(total / 10) * 10; 46 | const calculatedCheck = roundUp - total; 47 | 48 | return calculatedCheck === digit; 49 | }, 50 | }); 51 | } 52 | 53 | export default npi; 54 | -------------------------------------------------------------------------------- /packages/yup/src/phone.ts: -------------------------------------------------------------------------------- 1 | import { BaseSchema } from 'yup'; 2 | 3 | const NANP_REGEXP = /^(\+?1[\s.-]?)?\(?[2-9]\d{2}[\s).-]?\s?[2-9]\d{2}[\s.-]?\d{4}$/; 4 | 5 | function phone(this: Schema, msg: string): Schema { 6 | return this.test({ 7 | name: 'phone', 8 | exclusive: true, 9 | message: msg || 'This field is invalid', 10 | test(value) { 11 | if (!value) return true; 12 | 13 | return NANP_REGEXP.test(value); 14 | }, 15 | }); 16 | } 17 | 18 | export default phone; 19 | -------------------------------------------------------------------------------- /packages/yup/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["."], 4 | "exclude": ["dist", "build", "node_modules"] 5 | } 6 | -------------------------------------------------------------------------------- /packages/yup/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../dist/out-tsc", 5 | "module": "commonjs", 6 | "types": ["jest", "node"], 7 | "allowJs": true 8 | }, 9 | "include": ["**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /plop-templates/library/README.md.hbs: -------------------------------------------------------------------------------- 1 | # @availity/{{kebabCase packageName}} 2 | 3 | > {{packageDescription}} 4 | 5 | ## Installation 6 | 7 | ### NPM 8 | 9 | ```bash 10 | npm install @availity/{{kebabCase packageName}} 11 | ``` 12 | 13 | ### Yarn 14 | 15 | ```bash 16 | yarn add @availity/{{kebabCase packageName}} 17 | ``` 18 | -------------------------------------------------------------------------------- /plop-templates/library/main.js.hbs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Availity/sdk-js/f00663bf84c74a5c957d32fc78111582be045576/plop-templates/library/main.js.hbs -------------------------------------------------------------------------------- /plop-templates/library/main.test.js.hbs: -------------------------------------------------------------------------------- 1 | const {{pascalCase packageName}} = require('../src/{{kebabCase packageName}}') 2 | 3 | describe('{{kebabCase packageName}}', () => { 4 | test('should exist', () => { 5 | expect({{pascalCase packageName}}).toBeDefined(); 6 | }); 7 | }); 8 | -------------------------------------------------------------------------------- /plop-templates/library/package.json.hbs: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@availity/{{kebabCase packageName}}", 3 | "version": "1.0.0-alpha.0", 4 | "description": "{{packageDescription}}", 5 | "main": "src/{{kebabCase packageName}}.js", 6 | "keywords": [{{{packageKeywords}}}], 7 | "author": "{{userFullName}} <{{userEmail}}>", 8 | "engines": { 9 | "node": "^18.0.0 || ^20.0.0" 10 | }, 11 | "license": "MIT", 12 | "publishConfig": { 13 | "access": "public" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /plop-templates/resource/api-axios-ms-resource.js.hbs: -------------------------------------------------------------------------------- 1 | import AvMicroserviceApi from '../ms'; 2 | 3 | export default class Av{{pascalCase resourceName}} extends AvMicroserviceApi { 4 | constructor(config) { 5 | super({ 6 | path: '', 7 | name: '', 8 | ...config 9 | }); 10 | } 11 | } 12 | 13 | -------------------------------------------------------------------------------- /plop-templates/resource/api-axios-resource.js.hbs: -------------------------------------------------------------------------------- 1 | import AvApi from '../api'; 2 | 3 | export default class Av{{pascalCase resourceName}} extends AvApi { 4 | constructor(config) { 5 | super({ 6 | path: '', 7 | name: '', 8 | ...config, 9 | }); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /plop-templates/resource/api-axios-test.js.hbs: -------------------------------------------------------------------------------- 1 | import Av{{pascalCase resourceName}} from '../{{camelCase resourceName}}'; 2 | 3 | describe('Av{{pascalCase resourceName}}', () => { 4 | let api; 5 | 6 | test('should be defined', () => { 7 | api = new Av{{pascalCase resourceName}}(); 8 | expect(api).toBeDefined(); 9 | }); 10 | 11 | test('should handle no config passed in', () => { 12 | api = new Av{{pascalCase resourceName}}(); 13 | expect(api).toBeDefined(); 14 | }); 15 | }); 16 | 17 | -------------------------------------------------------------------------------- /scripts/artifactory-check.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Instructions: 4 | # 5 | # - In package.json add: 6 | # "scripts": { "check:registry": "sh ./scripts/artifactory-check.sh" } 7 | # 8 | # - Run: 9 | # npm run check:registry 10 | # yarn check:registry 11 | # 12 | 13 | # error out if something fails 14 | set -e 15 | 16 | if grep -R --exclude='*.sh' --exclude-dir='node_modules' --include='yarn.lock' -e 'artifactory.availity' -e 'packages.availity' ./; then 17 | printf "\n" 18 | printf " (c).-.(c) (c).-.(c) (c).-.(c) (c).-.(c) (c).-.(c) \n" 19 | printf " / ._. \ / ._. \ / ._. \ / ._. \ / ._. \ \n" 20 | printf " __\( Y )/__ __\( Y )/__ __\( Y )/__ __\( Y )/__ __\( Y )/__\n" 21 | printf " (_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)(_.-/'-'\-._)\n" 22 | printf " || E || || R || || R || || O || || R ||\n" 23 | printf " _.' \`-' '._ _.' \`-' '._ _.' \`-' '._ _.' \`-' '._ _.' \`-' '._\n" 24 | printf " (.-./\`-'\.-.)(.-./\`-\`\.-.)(.-./\`-\`\.-.)(.-./\`-'\.-.)(.-./\`-\`\.-.)\n" 25 | printf " \`-' \`-' \`-' \`-' \`-' \`-' \`-' \`-' \`-' \`-' \n" 26 | printf "\n\n" 27 | printf "\nOne of your packages contains a dependency from a private Availity registry.\n" 28 | printf "Please correct this by running 'yarn nuke' and then 'yarn' off of the Availity proxy.\n\n" 29 | exit 1 30 | else 31 | echo "Artifactory Check Passed" 32 | fi 33 | --------------------------------------------------------------------------------