Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gal 643/mesh module #2

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
857e0d4
Wip - adding services layer.
msandhuNHS Dec 4, 2023
1db78f9
Wip - Adding services layer.
msandhuNHS Dec 5, 2023
8b64587
Pushing updated package.json and run.js
msandhuNHS Dec 6, 2023
6152f3b
Updated apidoc headers an implemented receiver service
msandhuNHS Dec 6, 2023
63f4be2
Wip - receiver service.
msandhuNHS Dec 7, 2023
b9dd994
receiverService.js now working.
msandhuNHS Dec 7, 2023
55b8dff
Wip - writing unit test for mesh service.
msandhuNHS Dec 8, 2023
88228d3
Wrote unit test for sending and receiving a message.
msandhuNHS Dec 8, 2023
335b38c
wip - writing unit test for sending and receiving a file
msandhuNHS Dec 8, 2023
6e1458f
Completed unit test
msandhuNHS Dec 11, 2023
2d67058
fixed sandbox boolean and try catch for read messages
msandhuNHS Dec 11, 2023
7163d0d
Removed logs, added debug logs, made timout environmental variable, m…
msandhuNHS Dec 12, 2023
e2ff983
removed comments
msandhuNHS Dec 12, 2023
6b90378
fixed timeout function
msandhuNHS Dec 12, 2023
4f682f0
fixed timeout function
msandhuNHS Dec 12, 2023
97587b0
Added option to disable timeout with false bool
msandhuNHS Dec 12, 2023
87f2881
Added more descriptive error handling
msandhuNHS Dec 12, 2023
fc7268f
Added upper camelcase classnames
msandhuNHS Dec 12, 2023
7f63189
upper camelcase class names in test file and added default to switch …
msandhuNHS Dec 12, 2023
e05fbfc
removed dev dependencies
msandhuNHS Dec 12, 2023
57cbc3b
removed unused import
msandhuNHS Dec 12, 2023
ba10f1d
Merge branch 'main' into gal-643/mesh-module
msandhuNHS Dec 12, 2023
3b7cc8d
Now able to provide custom env variables
msandhuNHS Dec 13, 2023
ef8f83c
Changed test timeout to 50
msandhuNHS Dec 13, 2023
dee714d
added this context to sender/receiver agents
msandhuNHS Dec 14, 2023
295859a
forced uppercase classnames
msandhuNHS Dec 14, 2023
1e9ea95
forced uppercase classnames
msandhuNHS Dec 14, 2023
6c9794f
installed dependencies
msandhuNHS Dec 14, 2023
fcaa9b8
updated import statement
msandhuNHS Dec 14, 2023
26266ca
fixed case issue in import
msandhuNHS Dec 14, 2023
a3a79d9
updated env vars
msandhuNHS Dec 14, 2023
feda197
changed timeout value in mesh test
msandhuNHS Dec 15, 2023
a1d09ad
updated env vars test object
msandhuNHS Dec 15, 2023
8ade57f
updated env vars test object
msandhuNHS Dec 15, 2023
6026a7d
updated env vars test object
msandhuNHS Dec 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions babel.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {presets: ['@babel/preset-env']}
9 changes: 4 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async function loadConfig() {
throw result.error;
}

console.log("Environment variables loaded");
debug.log("Environment variables loaded");
}

await loadConfig();
Expand All @@ -36,7 +36,7 @@ let sandbox = process.env.MESH_SANDBOX || "true";
let senderAgent;
let receiverAgent;
if (sandbox === "true") {
console.log("Running in sandbox mode");
log.debug("Running in sandbox mode");
// just setup to ignore self-signed certs
senderAgent = new Agent({
rejectUnauthorized: false,
Expand All @@ -46,7 +46,7 @@ if (sandbox === "true") {
rejectUnauthorized: false,
});
} else {
console.log("Running in integration mode");
log.debug("Running in integration mode");
// Setup the https agents for integration, you can ignore this for sandbox
senderAgent = new Agent({
cert: readFileSync(process.env.MESH_SENDER_CERT_LOCATION),
Expand Down Expand Up @@ -130,7 +130,7 @@ async function createMessageChunks() {
});
}

async function receiveMessage() {
export async function receiveMessage() {
// Check connection to mailbox
log.debug("\nChecking connection to mailbox with handshake");
await handShake({
Expand All @@ -150,7 +150,6 @@ async function receiveMessage() {
sharedKey: sharedKey,
agent: receiverAgent,
});

// Loop through the message and read them. so they don't interfere with tests
if (inboxCount.data["approx_inbox_count"] > 0) {
log.info(
Expand Down
Loading