Gatekeeper's pdf/email Utils - shared in NPM
- Create a
.npmrc
file containing://registry.npmjs.org/:_authToken=<publish-npm-token>
. You can find the publishnpm-token
on onePassword.
- 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.md
changelog. - 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-utils
directory- Make sure you have jest installed on your machine.
- run
npm test
to test that all the functions are working correctly.
- Execute
cd report-utils
andnpm publish
in the terminal. - Commit & Push your changes to GitHub.
- In your CloudCode, open the
package.json
file 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.json
file. - In the JavaScript code add the following line at the top of the page:
const utils = require("@gatekeeper_technology/report-utils");
. - Create a
.npmrc
file (in the CC task) containing://registry.npmjs.org/:_authToken=<read-only-npm-token>
. You can find the read-onlynpm-token
on 1Password. - You can check at the top of this repo's
index.js
file to see which functions we export. We should update the list of functionality soon. - Happy coding!
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 -
- Updated the rollbar-utils version
-
dist
ignore file in.npmignore
.
- Added
postToJourneyBackend
function - Added
journeyApps
npm packages as dependencies to assist with the reportUtil package. - Added
sortArrayByField
function - Added
generateHTML
function - Added
formatText
function - Added
getImageContentForPDF
function
- Migrated to TypeScript
- All date functions should now be able to accept
Day
variables. -
.gitignore
file now ignores compiled files. -
isAttachment(s)Uploaded
functions no longer reschedules. It now throws an error with the cause =attachments-uploading
- Removed
loadBase64
function in a race against time.
- Jest Test cases
- formatText, sortArrayByField and generateHTML functions
- .d.ts files.
- Added more validation on general utils
- Unit Tests on General Utils.
- console.error() on date Utils.
- Fixed funky way of throwing errors
- Added a new utils folder with small internal utils
- When retrying a task, we don't need to specify the CloudCode task name as we can access it programmatically
- 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).
- isToday: Can be used via the isSameDay() function
- isPastDate and isFutureDate: Can be user via the compareDates() function
- Improved Test file (WIP)
- areEqualDates
- areEqualDateTimes
- isToday
- getStartOfWeek
- getEndOfWeek
- getWeekNumber
- isFutureDate
- isPastDate
- A bug where you cannot import the
report-utils
package in the/mobile
side of an App.
- [TESTING] Moved the
loadImageBase64
function toindex.js
to see if the required("fs") problem is fixed.
- [TESTING] Moved the require("fs") out of the function.
- Refactored the file structure to separate the concerns.
- Replaced
displayPhoto
withjourneyPhotoToBase64
, it now has a more descriptive name - Replaced
loadPhotoOrSignature
withgetPhotoOrSignatureData
, it's now up to the developer to load the data into a data hash. - Replaced
loadSignatureBase64
withencodeBase64ImagePNG
, renamed function and changed the input parameter to the actual image data.
-
index.js
: Added the ability to specify in which environments to enable email whitelisting.
-
index.js
: Emails are first trimmed and toLowerCase'd before checking if it is valid.
-
index.js
: Changed the wayloadAttachments
function receives retry_count value.
-
index.js
: a Bug where theloadPhotoOrSignature
function was out of date.
-
index.js
: Emails check now convert all emails to lowercase before checking for duplicates.
-
index.js
: Added functiondisplayTimeWithSeconds
.
-
index.js
: improved javadocs commenting .
-
Readme.md
: explanation improved. -
index.js
: Added functionsdisplayDateTime
anddisplayTime
.
-
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.