Package Exports
- @gatekeeper_technology/report-utils
- @gatekeeper_technology/report-utils/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@gatekeeper_technology/report-utils) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Gatekeeper's report utils
Gatekeeper's pdf/email Utils - shared in NPM
Set-up
- Create a
.npmrcfile containing://registry.npmjs.org/:_authToken=<publish-npm-token>. You can find the publishnpm-tokenon onePassword.
Updating
- Put your code changes in
index.js.- If you added a new function, write jest test cases for it.
- Update the version number in the
package.json. - Describe your changes in the
README.mdchangelog. - Test your code before publishing:
- Navigate one directory back
- Open the terminal.
- Execute
npm install @gatekeeper_technology/report-utils. - If any error fix them.
- Navigate back into the
report-utilsdirectory- Make sure you have jest installed on your machine.
- run
npm testto test that all the functions are working correctly.
- Execute
cd report-utilsandnpm publishin the terminal. - Commit & Push your changes to GitHub.
Using this package in a JourneyApps CloudCode Task.
- In your CloudCode, open the
package.jsonfile and make sure you have the following code:
, where"dependencies": { "@gatekeeper_technology/report-utils": "<current-version-number>" }<current-version-number>is the version number saved in this repo'spackage.jsonfile. - In the JavaScript code add the following line at the top of the page:
const utils = require("@gatekeeper_technology/report-utils");. - Create a
.npmrcfile (in the CC task) containing://registry.npmjs.org/:_authToken=<read-only-npm-token>. You can find the read-onlynpm-tokenon 1Password. - You can check at the top of this repo's
index.jsfile to see which functions we export. We should update the list of functionality soon. - Happy coding!
Functionality
This package has three parts
- date_time_utils - Functions that format JavaScript datetime objects to a readable/printable format
- email_utils - These functions ensure that the specified email addresses do not violate any of the SendGrid v3 requirements and implements whitelisting
- photo_attachment_utils -
Changelog
[1.3.1]
Removed
- Updated the rollbar-utils version
[1.2.1]
Removed
distignore file in.npmignore.
[1.2.0]
Added
- Added
postToJourneyBackendfunction - Added
journeyAppsnpm packages as dependencies to assist with the reportUtil package. - Added
sortArrayByFieldfunction - Added
generateHTMLfunction - Added
formatTextfunction - Added
getImageContentForPDFfunction
Changed
- Migrated to TypeScript
- All date functions should now be able to accept
Dayvariables. .gitignorefile now ignores compiled files.isAttachment(s)Uploadedfunctions no longer reschedules. It now throws an error with the cause =attachments-uploading
[1.1.10]
Removed
- Removed
loadBase64function in a race against time.
[1.1.9]
Added
- Jest Test cases
- formatText, sortArrayByField and generateHTML functions
- .d.ts files.
[1.1.8]
Changed
- Added more validation on general utils
Added
- Unit Tests on General Utils.
Removed
- console.error() on date Utils.
[1.1.7]
Changed
- Fixed funky way of throwing errors
- Added a new utils folder with small internal utils
[1.1.6]
Changed
- When retrying a task, we don't need to specify the CloudCode task name as we can access it programmatically
[1.1.5]
Added
- isSameDay: Checks if the given two dates falls on the same day (second date value defaults to now).
- compareDates: Checks if the given two dates falls on the same date and time (return 0), date 1 is before date 2 (returns -1), otherwise returns 1 (second date value defaults to now).
Removed
- isToday: Can be used via the isSameDay() function
- isPastDate and isFutureDate: Can be user via the compareDates() function
Changed
- Improved Test file (WIP)
[1.1.4]
Added
- areEqualDates
- areEqualDateTimes
- isToday
- getStartOfWeek
- getEndOfWeek
- getWeekNumber
- isFutureDate
- isPastDate
[1.1.3]
Fixed
- A bug where you cannot import the
report-utilspackage in the/mobileside of an App.
[1.1.2]
Changed
- [TESTING] Moved the
loadImageBase64function toindex.jsto see if the required("fs") problem is fixed.
[1.1.1]
Changed
- [TESTING] Moved the require("fs") out of the function.
[1.1.0]
Changed
- Refactored the file structure to separate the concerns.
- Replaced
displayPhotowithjourneyPhotoToBase64, it now has a more descriptive name - Replaced
loadPhotoOrSignaturewithgetPhotoOrSignatureData, it's now up to the developer to load the data into a data hash. - Replaced
loadSignatureBase64withencodeBase64ImagePNG, renamed function and changed the input parameter to the actual image data.
[1.00.07]
Added
index.js: Added the ability to specify in which environments to enable email whitelisting.
[1.00.06]
Changed
index.js: Emails are first trimmed and toLowerCase'd before checking if it is valid.
[1.00.05]
Changed
index.js: Changed the wayloadAttachmentsfunction receives retry_count value.
[1.00.04]
Fixed
index.js: a Bug where theloadPhotoOrSignaturefunction was out of date.
[1.00.03]
Changed
index.js: Emails check now convert all emails to lowercase before checking for duplicates.
[1.00.02]
Added
index.js: Added functiondisplayTimeWithSeconds.
Changed
index.js: improved javadocs commenting .
[1.00.01]
Changed
Readme.md: explanation improved.index.js: Added functionsdisplayDateTimeanddisplayTime.
[1.00.00]
Added
package.json: Added.index.js: Added and populated with Gatekeeper's handlebarUtil functions..npmignore: Added..gitignore: Added.README.md: Added with description, set-up and change-log.