fxa/packages/fxa-support-panel
Jared Hirsch 971296410f
Release 1.183.1
2020-08-06 14:46:37 -07:00
..
.vscode chore(deps): updated dependencies 2020-06-22 17:11:50 -07:00
bin docs(support-panel): add README and JSDoc 2019-12-19 09:42:43 -08:00
config chore(deps): updated dependencies 2020-06-22 17:11:50 -07:00
lib chore(deps): updated dependencies 2020-06-22 17:11:50 -07:00
test/lib feat (support + auth server): add past product information to support panel 2020-05-14 10:00:31 -07:00
.nsprc fix(deps): Add exception for yargs-parser nsp advisory 1500 2020-05-11 11:40:27 -07:00
CHANGELOG.md Release 1.183.1 2020-08-06 14:46:37 -07:00
README.md docs(all): update readmes across all packages to improve testing documentation 2020-05-06 12:02:21 -04:00
package.json Release 1.183.1 2020-08-06 14:46:37 -07:00
pm2.config.js chore(pm2): Add ISO timestamp to pm2 log lines 2020-06-17 17:01:16 -07:00
tsconfig.json refactor(tsconfig): consolidate common tsconfig options 2020-05-26 12:18:51 -07:00

README.md

fxa-support-panel

The Firefox Accounts Support Panel is a small web service that is intended for use as an embedded iframe in the Zendesk Support UX. It's intended to show Subscription Support Agents relevant data about a users Firefox Account so that they may assist the users support request.

Software Architecture

The primary source of truth on FxA user data is the fxa-auth-server. That service is configured to use OAuth for user and service access to account data, and has write access to the user data. Since this view is intended purely for read-only access to user data for assisting a support agent, this service instead queries a read-restricted version of the fxa-auth-db-mysql service (fxa-auth-server uses a full read/write fxa-auth-db-mysql service).

Read-only access is enforced on the database by using a MySQL user restricted to the stored procedures needed to run the queries that fetch basic profile information.

Code Organization

  • bin/ - Program directory (Note the runnable versions will be under dist/ when compiled)
    • worker - Primary entry point for running the support-panel in production.
  • config/ - Configuration loader and .json files for runtime environments.
  • lib/
    • api - Hapi routes and controller.
    • server - Hapi server setup and CSP configuration for above api.
  • test - Unit tests, organized in matching heirarchy with the root supprt-panel directory.
  • types - Additional TypeScript definitions for dependencies missing type information.

Testing

This package uses Mocha to test its code. By default npm test will test all files ending under test/, and uses ts-node so it can process TypeScript files.

Test specific tests with the following commands:

# Test only test/lib/api.spec.ts
npx mocha -r ts-node/register test/lib/api.spec.ts

# Grep for "has a heartbeat"
npx mocha -r ts-node/register test/*/** -g "has a heartbeat"

Refer to Mocha's CLI documentation for more advanced test configuration.