Skip to content

Commit

Permalink
Merge pull request #41 from bcgov/mvp-239-tweaks
Browse files Browse the repository at this point in the history
MVP-239: DevHub Tweaks
  • Loading branch information
BradyMitch authored May 16, 2024
2 parents 76ba77e + f3ee077 commit 17ace4f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion techdocs/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

This npm package offers the CSS (Common Hosted Single Sign-on) API Account functionality through easy to use functions in your NodeJS application. The CSS API Account is part of the B.C. government's Single Sign-On SSO (CSS) service and is used to manage your SSO integrations through code instead of through the dashboard. This can be used to add or remove user roles and much more. Endpoints in the CSS API are offered as JavaScript functions in this package.

- Built for a NodeJS:20 React app.
- Built for a NodeJS:20.
- For [CSS] Teams with a [CSS API Account].
- Works with Vanilla JavaScript or TypeScript 5.
- Built for standalone use. Does NOT require [@bcgov/citz-imb-sso-react] or [@bcgov/citz-imb-sso-express]
Expand Down
5 changes: 5 additions & 0 deletions techdocs/docs/using-the-package/module-exports.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

These are the functions and types exported by the package.

Functions are modeled after the API endpoints of the [CSS Swagger Docs].

```JavaScript
import {
getIntegration, // Get integration details.
Expand Down Expand Up @@ -33,3 +35,6 @@ import {
GitHubUserQuery, // Query type when using getGitHubBCGovUsers or getGitHubPublicUsers.
} from '@bcgov/citz-imb-sso-css-api';
```

<!-- Reference links -->
[CSS Swagger Docs]: https://api.loginproxy.gov.bc.ca/openapi/swagger
21 changes: 21 additions & 0 deletions techdocs/docs/using-the-package/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,24 @@ Sometimes issues may arise when using the packages for the first time, or when u
If an issue persists after following all the proper setup guides, you can set `DEBUG` and `VERBOSE_DEBUG` environment variables to `true` to get more detailed console logs. These logs may help you spot an issue such as a bad response from the CSS API.

If you can't resolve the problem yourself, open a [Bug Report](https://github.com/bcgov/citz-imb-sso-css-api/issues/new?assignees=&labels=bug&projects=&template=bug_report.md&title=Bug%3A+) and mention any issues you've found in your troubleshooting.

<br />

## Common Issues

### Function Results in a `Promise { <pending> }`

Each of the functions provided by this package are asynchronous. This means that the function will run in the background without blocking other events from running, and then once the funtion has completed, it will return the result.

If the function you are trying to use is returning `Promise { <pending> }` it is because you are not awaiting the result of the async function.

Make sure your call to the function is within an `async` function or that async functions can be awaited at the top level of your file, and that the function is proceeded by the `await` keyword. Alternatively, you can use the promise chaining syntax such as `getIntegration().then(result => console.log(result));`

If you wish to resolve multiple functions at once, an option is to use `Promise.all` like in the example below:

```JavaScript
const [integration, roles] = await Promise.all([
getIntegration(),
getRoles()
]);
```

0 comments on commit 17ace4f

Please sign in to comment.