1.13.0 • Published 5 years ago
@alaka/notifications v1.13.0
Alaka notification functions
Light-weight Javascript wrapper for Alaka notification API
Development
This project uses eslint for linting and prettier for formatting javascript code.
Git commit will failed if staged files don't pass linting!
VSCode plugins
VSCode format on save
In Preferences->Settings search and check option editor.formatOnSave
for Workspace settings
Project structure
All notification are located in src/functions
directory. Notifications are grouped by roles.
src/
| ...
└─── functions
└─── matchManager
│ purchaseOrderReceived.js
│ ...
└─── supplier
positionPublished.js
...
All new notification functions must be registered in src/notifications.js
file.
Installation and configuration
Install via npm
npm install --save @alaka/notifications
Import package
CommonJS
const notificationService = require('@alaka/notifications');
ES6
import notificationService from '@alaka/notifications';
Initialization
/**
* @param {object} config
* @param {string} config.API_endpoint API endpoint for 8base workspace
* @param {string} config.API_token 8base token for workspace
* @param {bool} [config.devMode=false] Enable dev mode (Don't send emails to subscribers and log result in console)
* @param {string} [config.devEmail] Email to send notification for development mode
* @param {bool} [config.failSilent=true] Don't throw exception on notification service error.
* @returns {object} List of actions for notification events
*/
const notifications = notificationService(config);
Notifications
List of notifications
Match manager
- Position was created
- Position was successfully parsed
- Position parsing failed
- Position ownership claimed
- Position ownership removed
- Candidate submitted to Alaka
- Candidate withdrawn
- Candidate edited
- Onboarding - Supplier accepted start date
- Onboarding - Supplier rejected start date
- Onboarding - PM accepted start date
- Onboarding - PM rejected start date
- Onboarding - Supplier uploaded forms
- Onboarding - Supplier withdrew candidate
- Onboarding - PM created purchase order
Supplier
- Position was published
- Position was unpublished
- Position was cancelled
- Candidate submitted to Alaka
- Candidate rejected by match manager
- Candidate submitted to client
- Candidate rejected by client
- Candidate selected by client
- Candidate revision was requested
- Onboarding - Request forms from supplier
- Onboarding - Purchase order received
Project Manager
- New candidate submitted
- Onboarding cancelled by MM
- Onboarding start date confirmed by MM
- Onboarding forms uploaded by MM
Match manager notifications
Position was created
/**
* @param {object} params
* @param {string} params.position Position id
* @param {string} params.link Link to position card
* @param {string} params.createdBy User id who triggered notification
* @returns {Promise<string>} Brief result about notification event
* @throws Error on missing or bad args
*/
positionCreated(params);
Position was successfully parsed
/**
* @param {object} params
* @param {string} params.rfq RFQ number/code e.g. 0-1234
* @param {string} params.project Project id
* @param {string} params.link Link to parsed position
* @returns {Promise<string>} Brief result about notification event
* @throws Error on missing or bad args
*/
positionParsedSuccess(params);
Position parsing failed
/**
* @param {object} params
* @param {string} params.project Project id
* @param {string} params.link Link to file/email box which couldn't be parsed
* @param {string} params.createdBy User id who triggered notification
* @returns {Promise<string>} Brief result about notification event
* @throws Error on missing or bad args
*/
positionParsedError(params);
Position ownership claimed
/**
* @param {object} params
* @param {string} params.project Project id
* @param {string} params.link Link to file/email box which couldn't be parsed
* @param {string} params.createdBy User id who triggered notification
* @returns {Promise<string>} Brief result about notification event
* @throws Error on missing or bad args
*/
positionOwnershipClaimed(params);
Position ownership removed
/**
* @param {object} params
* @param {string} params.project Project id
* @param {string} params.link Link to file/email box which couldn't be parsed
* @param {string} params.createdBy User id who triggered notification
* @returns {Promise<string>} Brief result about notification event
* @throws Error on missing or bad args
*/
positionOwnershipRemoved(params);
Candidate submitted to Alaka (Match manager)
/**
* @param {object} params
* @param {string} params.candidate Candidate id
* @param {string} params.candidateLink Link to candidate card
* @param {string} params.positionLink Link to select candidates page for position
* @returns {Promise<string>} Brief result about notification event
* @throws Error on missing or bad args
*/
candidateSubmittedToAlakaMatchManager(params);
Candidate withdrawn
/**
* @param {object} params
* @param {string} params.candidate Candidate id
* @param {string} params.link Link to candidate card
* @param {string} params.createdBy User id who triggered notification
* @returns {Promise<string>} Brief result about notification event
* @throws Error on missing or bad args
*/
candidateWithdrawn(params);
Candidate edited
/**
* @param {object} params
* @param {string} params.candidate Candidate id
* @param {string} params.link Link to candidate card
* @param {string} params.createdBy User id who triggered notification
* @returns {Promise<string>} Brief result about notification event
* @throws Error on missing or bad args
*/
candidateEdited(params);
Onboarding - Supplier accepted start date
/**
* @param {object} params
* @param {string} params.candidate Candidate id
* @param {string} params.link Link to start date details
* @param {string} params.createdBy User id who triggered notification
* @returns {Promise<string>} Brief result about notification event
* @throws Error on missing or bad args
*/
onboardingStartDateAcceptedBySupplier(params);
Onboarding - Supplier rejected start date
/**
* @param {object} params
* @param {string} params.candidate Candidate id
* @param {string} params.link Link to start date details
* @param {string} params.createdBy User id who triggered notification
* @returns {Promise<string>} Brief result about notification event
* @throws Error on missing or bad args
*/
onboardingStartDateRejectedBySupplier(params);
Onboarding - PM accepted start date
/**
* @param {object} params
* @param {string} params.candidate Candidate id
* @param {string} params.link Link to start date details
* @param {string} params.createdBy User id who triggered notification
* @returns {Promise<string>} Brief result about notification event
* @throws Error on missing or bad args
*/
onboardingStartDateAcceptedByPM(params);
Onboarding - PM rejected start date
/**
* @param {object} params
* @param {string} params.candidate Candidate id
* @param {string} params.link Link to start date details
* @param {string} params.createdBy User id who triggered notification
* @returns {Promise<string>} Brief result about notification event
* @throws Error on missing or bad args
*/
onboardingStartDateRejectedByPM(params);
Onboarding - Supplier uploaded forms
/**
* @param {object} params
* @param {string} params.candidate Candidate id
* @param {string} params.link Link to forms details
* @param {string} params.createdBy User id who triggered notification
* @returns {Promise<string>} Brief result about notification event
* @throws Error on missing or bad args
*/
onboardingFormsUploaded(params);
Onboarding - Supplier withdrew candidate
/**
* @param {object} params
* @param {string} params.candidate Candidate id
* @param {string} params.link Link to onboarding details
* @param {string} params.createdBy User id who triggered notification
* @returns {Promise<string>} Brief result about notification event
* @throws Error on missing or bad args
*/
onboardingCandidateWithdrawn(params);
Onboarding - PM created purchase order
/**
* @param {object} params
* @param {string} params.candidate Candidate id
* @param {string} params.link Link to PO
* @param {string} params.createdBy User id who triggered notification
* @returns {Promise<string>} Brief result about notification event
* @throws Error on missing or bad args
*/
onboardingPurchaseOrderCreated(params);
Supplier notifications
Position was published
/**
* @param {object} params
* @param {string} params.position Position id
* @param {string} params.link Link to published position
* @param {string} params.createdBy User id who triggered notification
* @returns {Promise<string>} Brief result about notification event
* @throws Error on missing or bad args
*/
positionPublished(params);
Position was unpublished
/**
* @param {object} params
* @param {string} params.position Position id
* @param {string} params.link Link to published position
* @param {string} params.createdBy User id who triggered notification
* @returns {Promise<string>} Brief result about notification event
* @throws Error on missing or bad args
*/
positionUnpublished(params);
Position was cancelled
/**
* @param {object} params
* @param {string} params.position Position id
* @param {string} params.link Link to cancelled position
* @param {string} params.createdBy User id who triggered notification
* @returns {Promise<string>} Brief result about notification event
* @throws Error on missing or bad args
*/
positionCancelled(params);
Candidate submitted to Alaka (Supplier)
/**
* @param {object} params
* @param {string} params.candidate Candidate id
* @param {string} params.link Link to candidate card
* @param {string} params.createdBy User id who triggered notification
* @returns {Promise<string>} Brief result about notification event
* @throws Error on missing or bad args
*/
candidateSubmittedToAlakaSupplier(params);
Candidate rejected by match manager
/**
* @param {object} params
* @param {string} params.candidate Candidate id
* @param {string} params.link Link to candidate card
* @param {string} params.createdBy User id who triggered notification
* @returns {Promise<string>} Brief result about notification event
* @throws Error on missing or bad args
*/
candidateRejectedByMatchManager(params);
Candidate submitted to client
/**
* @param {object} params
* @param {string} params.candidate Candidate id
* @param {string} params.link Link to candidate card
* @param {string} params.createdBy User id who triggered notification
* @returns {Promise<string>} Brief result about notification event
* @throws Error on missing or bad args
*/
candidateSubmittedToClient(params);
Candidate rejected by client
/**
* @param {object} params
* @param {string} params.candidate Candidate id
* @param {string} params.link Link to candidate card
* @param {string} params.createdBy User id who triggered notification
* @returns {Promise<string>} Brief result about notification event
* @throws Error on missing or bad args
*/
candidateRejectedByClient(params);
Candidate selected by client
/**
* @param {object} params
* @param {string} params.candidate Candidate id
* @param {string} params.link Link to supplier on-boarding start date confirmation
* @param {string} params.createdBy User id who triggered notification
* @returns {Promise<string>} Brief result about notification event
* @throws Error on missing or bad args
*/
candidateSelectedByClient(params);
Candidate revision was requested
/**
* @param {object} params
* @param {string} params.candidate Candidate id
* @param {string} params.link Link to supplier on-boarding start date confirmation
* @param {string} params.createdBy User id who triggered notification
* @returns {Promise<string>} Brief result about notification event
* @throws Error on missing or bad args
*/
candidateRevisionRequested(params);
Onboarding - Request forms
/**
* @param {object} params
* @param {string} params.candidate Candidate id
* @param {string} params.link Link to supplier on-boarding forms
* @param {string} params.createdBy User id who triggered notification
* @returns {Promise<string>} Brief result about notification event
* @throws Error on missing or bad args
*/
onboardingRequestForms(params);
Onboarding - Purchase order received
/**
* @param {object} params
* @param {string} params.candidate Candidate id
* @param {string} params.link Link to supplier on-boarding purchase order details
* @param {string} params.createdBy User id who triggered notification
* @returns {Promise<string>} Brief result about notification event
* @throws Error on missing or bad args
*/
onboardingPurchaseOrderReceived(params);
Project manager notifications
New candidate submitted
/**
* @param {object} params
* @param {string} params.candidate Candidate id
* @param {string} params.link Link to candidate card
* @param {string} params.createdBy User id who triggered notification
* @returns {Promise<string>} Brief result about notification event
* @throws Error on missing or bad args
*/
newCandidateSubmitted(params);
Onboarding cancelled by MM
/**
* @param {object} params
* @param {string} params.candidate Candidate id
* @param {string} params.link Link to supplier on-boarding start date details
* @param {string} params.createdBy User id who triggered notification
* @returns {Promise<string>} Brief result about notification event
* @throws Error on missing or bad args
*/
onboardingCancelledByMatchManager(params);
Onboarding start date confirmed by MM
/**
* @param {object} params
* @param {string} params.candidate Candidate id
* @param {string} params.link Link to supplier on-boarding start date details
* @param {string} params.createdBy User id who triggered notification
* @returns {Promise<string>} Brief result about notification event
* @throws Error on missing or bad args
*/
onboardingStartDateAcceptedByMM(params);
Onboarding forms uploaded by MM
/**
* @param {object} params
* @param {string} params.candidate Candidate id
* @param {string} params.link Link to supplier on-boarding forms
* @param {string} params.createdBy User id who triggered notification
* @returns {Promise<string>} Brief result about notification event
* @throws Error on missing or bad args
*/
onboardingFormsUploadedByMM(params);