Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • (tick) indicates that the framework is currently supported.
  • (error) indicates that the framework is not yet supported.

Library

Comment

Data Access

Web Service

Supported versions

ExpressNode.js application framework
(tick)4.x
MongooseMongoDB access(tick)
5.x
SequelizeNode.js application framework(tick)
5.x; 6.x
TypeORMORM(tick)
0.2.x
FastifyNode.js server
(tick)3.x
AxiosPromise based HTTP client
(tick)0.x
Node-mongodb-nativeMongoDB access(tick)
3.x
nestjsNode.js application framework
(tick)6.x; 7.x
httpsNode.js web service
(tick)
fetchJavaScript builtin web service
(tick)
requestHTTP request client 'request'
(tick)2.x

request-promise

HTTP request client 'request'
(tick)4.x
request-promise-nativeHTTP request client 'request'
(tick)1.x
request-promise-anyHTTP request client 'request'
(tick)1.x
Mongo-clientMongoDB access(error)

CouchdbCouchdb access(error)

Node-couchdbCouchdb access(error)

Couchdb-nanoCouchdb access(error)

MarklogicMarklogic access(error)

my_connectionMySQL access(tick)
0.x
pgPostgreSQL access(tick)
7.x; 8.x
oracledbOracle Database access(tick)
4.x; 5.x

node-sqlserver

MsnodeSQL access(tick)
0.x

mssql

MsSQL access(tick) 
5.x; 6.x
HapiNode.js application framework(error)

SailsNode.js application framework(error)(error)
LoopbackNode.js application framework

(error)

(error)
KoaNode.js application framework(error)

KnexNode.js SQL query builder (error)

MemcachedStorage framework(error)

AWS.DynamoDBAmazon database access(tick)
SDK 2.x
AWS.S3Amazon storage service(tick)
2x

SDK 2.x
AWS.LambdaAmazon routing solution
(tick)Cloudformation, Serverless framework, SAM
AWS.SQSAmazon Simple Queue Service
(tick)SDK 2.x

Supported Emailing frameworks: @sendgrid/mail, nodemailer

...

Expand

Support of arrow functions and methods

Arrow functions which have been introduced in typescript following ES6 standard (also known as ES2015) are supported. Since arrow functions are equivalent to standard functions, the same function objects are created by the analyzer for both standard functions and arrow functions. Arrow functions can also define methods in which case method objects are created by the analyzer. Examples of arrow functions and methods are provided in the Objects section of this documentation.

Support of anonymous functions

For anonymous functions, the analyzer creates function objects named <Anonymous$i> where $i is incremented such that each anonymous function object has a unique fullname.

Web Services

XMLHttpRequest

The analysis of the following code will create a TypeScript GET http service named "foo/url" and a callLink between my_func function and that service :

function my_func(){

  var xhttp = new XMLHttpRequest();
  xhttp.open("GET", "foo/url", false);
  xhttp.send();

}

 Image Modified

fetch

The analysis of the following code will create a TypeScript POST http service named "foo/url" and a callLink between my_func function and that service :

Code Block
function my_func(){
  const response = await fetch('foo/path', {
    method: 'POST'
  })
}

Window variable

The JavaScript window variable can be used to pass values such as urls. The windows variable is accessible from all modules. So when analyzing the following modules:

Code Block
languagejs
titlemodule1.py
window.myurl = "foo/url/"


Code Block
languagejs
titlemodule2.py
function my_func(){

  var xhttp = new XMLHttpRequest();
  xhttp.open("GET", window['myurl'], false);
  xhttp.send();

}

a webservice object is created with the url set through the window variable: 

...

Support for AWS XRay


Expand

aws-xray encapsulates AWS methods calls in order to provide status and load status. However, the encapsulation did not allow the extension to provide objects and links. With the support of AWS XRay starting in 2.6.0-beta4, these objects and links will be created.

Code samples

This code will encapsulate AWS SDK then create a dynamoDB instance, and a Table instance.


Code Block
languagejs
import AWSXRay from 'aws-xray-sdk-core'
import AWS from 'aws-sdk'
const AWS = AWSXRay.captureAWS(AWS) // Encapsulate AWS SDK
const DDB = new AWS.DynamoDB({ apiVersion: "2012-10-08" }) // use AWS as usual
const { v1: uuidv1 } = require('uuid');
 
// environment variables
const { TABLE_NAME, ENDPOINT_OVERRIDE, REGION } = process.env
const options = { region: REGION }
AWS.config.update({ region: REGION })
 
if (ENDPOINT_OVERRIDE !== "") {
    options.endpoint = ENDPOINT_OVERRIDE
}
 
const docClient = new AWS.DynamoDB.DocumentClient(options)
// response helper
const response = (statusCode, body, additionalHeaders) => ({
    statusCode,
    body: JSON.stringify(body),
    headers: { 'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*', ...additionalHeaders },
})
 

 
function addRecord(event) {
 
    let usernameField = {
        "cognito-username": getCognitoUsername(event)
    }
 
    // auto generated date fields
    let d = new Date()
    let dISO = d.toISOString()
    let auto_fields = {
        "id": uuidv1(),
        "creation_date": dISO,
        "lastupdate_date": dISO
    }
 
    //merge the json objects
    let item_body = {...usernameField, ...auto_fields, ...JSON.parse(event.body) }
 
    console.log(item_body);
     
    //final params to DynamoDB
    const params = {
        TableName: TABLE_NAME,
        Item: item_body
    }
 
    return docClient.put(params)
}
 


What results can you expect?

Once the analysis/snapshot generation has been completed, you can view the results with your favorite tool (for example via CAST Enlighten):

Click to enlarge

Image Modified

Analysis of the code sample

Known limitations for AWS support

...