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

Neptune Analytics Support & Logger #3

Closed
wants to merge 45 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
3395a29
Update getEdgesDirections queries
Cole-Greer Mar 28, 2024
6f1afeb
Neptune Analytics - Logger
AndreaNassisi May 21, 2024
c102a84
Merge remote-tracking branch 'origin/updateGetEdgesDirections' into N…
AndreaNassisi May 21, 2024
5e54131
Update getEdgesDirections queries
Cole-Greer Mar 28, 2024
83307b6
cherry pick 'Neptune Analytics - Logger' from #19
AndreaNassisi May 21, 2024
9ac1bfa
cherry pick 'Merge remote-tracking branch...' from #19
sophiadt Sep 17, 2024
936614f
Test milestone
AndreaNassisi Jul 10, 2024
ebb2875
Test package
AndreaNassisi Jul 10, 2024
615569c
change consoleOut.error to console.error
sophiadt Sep 18, 2024
b95c4d3
Skipped retrieving neptune cluster info for analytics.
andreachild Sep 18, 2024
4254af8
added in AndreaC's fixes to todo schema, commas and incorrect orderin…
sophiadt Sep 19, 2024
90cffc8
reverted endpoint config in unit tests
sophiadt Sep 19, 2024
8573166
Revert "Update getEdgesDirections queries"
sophiadt Sep 19, 2024
b5e80c2
fixed error message typo
sophiadt Sep 19, 2024
bbbd7b6
Modified logger method to accept flag which dictates if given text sh…
andreachild Sep 19, 2024
71791fa
Reverted a change which would have too verbose output to console.
andreachild Sep 19, 2024
d59383d
change if statement to check if endpoint has exactly 2 parts
sophiadt Sep 20, 2024
63ee6a4
Merge branch 'sophiadt/Neptune-Analytics---Logger' into achild/Neptun…
sophiadt Sep 20, 2024
6c27318
Merge pull request #2 from Bit-Quill/achild/Neptune-Analytics---Logger
sophiadt Sep 20, 2024
a5dbb3a
Removed default region and changed parsing of region from URL to diff…
andreachild Sep 20, 2024
8623a70
removed code for dual lamba option and read-only endpoints
sophiadt Sep 23, 2024
12691dd
added host and port placeholders
sophiadt Sep 24, 2024
d60e36b
Changed queryNeptune and queryNeptuneSdk to take optional parameters …
andreachild Sep 26, 2024
f1326f5
Merge branch 'main' into sophiadt/Neptune-Analytics---Logger
sophiadt Sep 26, 2024
f4b7335
use parameterized query for getEdgeProperties
sophiadt Sep 27, 2024
c162b62
use parameterized queries for the rest of the functions and added typ…
sophiadt Sep 27, 2024
16c431a
merge 'Update getEdgesDirections queries' from #16
Cole-Greer Mar 28, 2024
77794f0
add sanitize placeholder function and reverted queries to use labels
sophiadt Oct 3, 2024
dbecfb8
remove params in function call for queries that aren't parameterized
sophiadt Oct 3, 2024
dc987c0
Replaced file and console logging with the pino logger library for ea…
andreachild Oct 4, 2024
8f63bb9
Remove duplicated sanitize function.
andreachild Oct 4, 2024
88385cb
Integrate usage of neptune graph SDK for schema queries and lambda lo…
andreachild Oct 8, 2024
a6e89ac
Fixed pino dependencies and updated tarball with latest.
andreachild Oct 9, 2024
121a8ae
Fixed packaging to include the new analytics sdk template.
andreachild Oct 9, 2024
ee28939
Fixed lambda environment variables to include neptune type which is r…
andreachild Oct 9, 2024
70293fc
fixed typo in README.md
sophiadt Oct 9, 2024
38ad71c
fixed typos
sophiadt Oct 9, 2024
477d819
Refactor console output and introduce file log levels (#6)
andreachild Oct 11, 2024
98f4a05
fixed typos in README.md
sophiadt Oct 11, 2024
20bd7e7
fixed typos and added some more details in README.md
sophiadt Oct 11, 2024
cda89f1
Merge branch 'main' into sophiadt/Neptune-Analytics---Logger
andreachild Oct 11, 2024
563c2da
Merge branch 'main' into sophiadt/Neptune-Analytics---Logger
andreachild Oct 11, 2024
4c06de9
Merge branch 'main' into sophiadt/Neptune-Analytics---Logger
andreachild Oct 15, 2024
79069b3
Merge branch 'main' into sophiadt/Neptune-Analytics---Logger
andreachild Oct 15, 2024
d737463
Cleanup of changes that shouldn't have been included when merging fro…
andreachild Oct 16, 2024
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
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@
"graphql": "^16.8.1",
"graphql-tag": "2.12.6",
"ora": "7.0.1",
"semver": "7.5.4"
"semver": "7.5.4",
"pino": "9.4.0",
"pino-pretty": "11.2.2"
},
"devDependencies": {
"@jest/test-sequencer": "^29.7.0",
Expand Down
4 changes: 0 additions & 4 deletions samples/todo.schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,4 @@ type Todo {

type Comment {
content: String
}

input Options {
limit: Int
}
33 changes: 16 additions & 17 deletions src/CDKPipelineApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { readFile, writeFile } from 'fs/promises';
import fs from 'fs';
import archiver from 'archiver';
import ora from 'ora';
import { loggerDebug, loggerError, loggerInfo, yellow } from "./logger.js";

let NAME = '';
let REGION = '';
Expand All @@ -33,11 +34,7 @@ let APPSYNC_ATTACH_QUERY = [];
let APPSYNC_ATTACH_MUTATION = [];
let SCHEMA_MODEL = null;
let thisOutputFolderPath = './output';


function yellow(text) {
return '\x1b[33m' + text + '\x1b[0m';
}
let msg = '';

async function getSchemaFields(typeName) {
/* To be updated as:
Expand Down Expand Up @@ -69,7 +66,7 @@ async function createDeploymentFile(folderPath, zipFilePath) {
archive.file('./output/output.resolver.graphql.js', { name: 'output.resolver.graphql.js' })
await archive.finalize();
} catch (err) {
console.error('Creating deployment zip file: ' + err);
loggerError('Creating deployment zip file: ' + err);
}
}

Expand Down Expand Up @@ -107,32 +104,32 @@ async function createAWSpipelineCDK({

if (neptuneType === 'neptune-db') {
try {
if (!quiet) console.log('Get Neptune Cluster Info');
loggerInfo('Getting Neptune Cluster Info');
if (!quiet) spinner = ora('Getting ...').start();
neptuneClusterInfo = await getNeptuneClusterDbInfoBy(NEPTUNE_DB_NAME, REGION);
if (!quiet) spinner.succeed('Got Neptune Cluster Info');
if (isNeptuneIAMAuth) {
if (!neptuneClusterInfo.isIAMauth) {
console.error("The Neptune database authentication is set to VPC.");
console.error("Remove the --output-aws-pipeline-cdk-neptune-IAM option.");
loggerError("The Neptune database authentication is set to VPC.");
loggerError("Remove the --output-aws-pipeline-cdk-neptune-IAM option.");
process.exit(1);
}
} else {
if (neptuneClusterInfo.isIAMauth) {
console.error("The Neptune database authentication is set to IAM.");
console.error("Add the --output-aws-pipeline-cdk-neptune-IAM option.");
loggerError("The Neptune database authentication is set to IAM.");
loggerError("Add the --output-aws-pipeline-cdk-neptune-IAM option.");
process.exit(1);
} else {
if (!quiet) console.log(`Subnet Group: ` + yellow(neptuneClusterInfo.dbSubnetGroup));
loggerDebug(`Subnet Group: ` + neptuneClusterInfo.dbSubnetGroup, {toConsole: true});
}
}

if (neptuneClusterInfo.version != '') {
const v = neptuneClusterInfo.version;
if (lambdaFilesPath.includes('SDK') == true && //semver.satisfies(v, '>=1.2.1.0') ) {
(v == '1.2.1.0' || v == '1.2.0.2' || v == '1.2.0.1' || v == '1.2.0.0' || v == '1.1.1.0' || v == '1.1.0.0')) {
console.error("Neptune SDK query is supported starting with Neptune versions 1.2.1.0.R5");
console.error("Switch to Neptune HTTPS query with option --output-resolver-query-https");
(v == '1.2.1.0' || v == '1.2.0.2' || v == '1.2.0.1' || v == '1.2.0.0' || v == '1.1.1.0' || v == '1.1.0.0')) {
loggerError("Neptune SDK query is supported starting with Neptune versions 1.2.1.0.R5");
loggerError("Switch to Neptune HTTPS query with option --output-resolver-query-https");
process.exit(1);
}
}
Expand All @@ -143,13 +140,15 @@ async function createAWSpipelineCDK({
NEPTUNE_IAM_POLICY_RESOURCE = neptuneClusterInfo.iamPolicyResource;

} catch (error) {
msg = 'Error getting Neptune Cluster Info: ' + JSON.stringify(error);
loggerError(msg);
if (!quiet) spinner.fail("Error getting Neptune Cluster Info.");
if (!isNeptuneIAMAuth) {
spinner.clear();
console.error("VPC data is not available to proceed.");
loggerError("VPC data is not available to proceed.");
process.exit(1);
} else {
if (!quiet) console.log("Proceeding without getting Neptune Cluster info.");
loggerInfo("Proceeding without getting Neptune Cluster info.", {toConsole: true});
}
}
}
Expand Down
Loading