...
- TypeScript is an open-source programming language. It is a superset of JavaScript that adds optional typing and that compiles to plain JavaScript.
- Angular is a front-end web framework used to create modern web platform capabilities.
- React and React-Native are frameworks for building user interfaces
- Node.js is a run-time environment that executes JavaScript code outside of a browser thus allowing to develop the server-side of an application using TypeScript.
- Express is a server web framework.
- Fastify is a server web framework.
- Axios is a promise based HTTP client.
- Mongoose is a MongoDB object modelling modeling tool designed to work in an asynchronous environment.
- AWS is a cloud service by Amazon.
- TypeORM is an Object-Relational Mapping framework.
- Sequelize is a framework for database management.
...
TypeScript
Version | Supported |
---|---|
1.x |
|
2.x | |
3.x | |
4.x |
Angular
Version | Supported |
---|---|
2 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 |
React
Version | Supported |
---|---|
15.x | |
16.x |
...
Library | Comment | Data Access | Web Service | Supported versions | |||
---|---|---|---|---|---|---|---|
Express | Node.js application framework | 4.x | |||||
Mongoose | MongoDB access | 5.x | |||||
Sequelize | Node.js application framework | 5.x; 6.x | |||||
TypeORM | ORM | 0.2.x | |||||
Fastify | Node.js server | 3.x | |||||
Axios | Promise based HTTP client | 0.x | |||||
Node-mongodb-native | MongoDB access | 3.x | |||||
nestjs | Node.js application framework | 6.x; 7.x | |||||
https | Node.js web service | ||||||
fetch | JavaScript builtin web service | ||||||
request | HTTP request client 'request' | 2.x | |||||
request-promise | HTTP request client 'request' | 4.x | |||||
request-promise-native | HTTP request client 'request' | 1.x | |||||
request-promise-any | HTTP request client 'request' | 1.x | |||||
Mongo-client | MongoDB access | ||||||
Couchdb | Couchdb access | ||||||
Node-couchdb | Couchdb access | ||||||
Couchdb-nano | Couchdb access | ||||||
Marklogic | Marklogic access | ||||||
my_connection | MySQL access | 0.x | |||||
pg | PostgreSQL access | 7.x; 8.x | |||||
oracledb | Oracle Database access | 4.x; 5.x | |||||
node-sqlserver | MsnodeSQL access | 0.x | |||||
mssql | MsSQL access | 5.x; 6.x | |||||
Hapi | Node.js application framework | ||||||
Sails | Node.js application framework | ||||||
Loopback | Node.js application framework | ||||||
Koa | Node.js application framework | ||||||
Knex | Node.js SQL query builder | ||||||
Memcached | Storage framework | AWS.DynamoDB | Amazon database access | ||||
AWS.S3 | Amazon storage service | 2x | SDK 2.x | ||||
AWS.Lambda | Amazon routing solution | Cloudformation, Serverless framework, SAM | |||||
AWS.SQS | Amazon Simple Queue Service | SDK 2.x |
Supported Emailing frameworks: @sendgrid/mail, nodemailer
Files analyzed
Icon(s) | File | Extension |
---|---|---|
TypeScript | .ts | |
TypeScript | .tsx |
...
Warning | ||
---|---|---|
| ||
The TypeScript analyzer will automatically skip files inside folders (or sub-folders) that by convention pertain to either external libraries or unit-testing. Currently, the following are skipped:
As mentioned in the introduction, TypeScript is a language that will be compiled to generate JavaScript files. Sometimes, the delivery will include these files, this is why the analyzer will skip the generated JavaScript files if we find their original TypeScript file. |
Function Point, Quality, and Sizing support
...
Info |
---|
The latest release status of this extension can be seen when downloading it from the CAST Extend server. |
Packaging, delivering, and analyzing your source code
Once the extension is downloaded and installed, you can now package your source code and run an analysis. The process of packaging, delivering and analyzing your source code is described below:
...
Icon | Metamodel name | Code Reference (example) | |||||
---|---|---|---|---|---|---|---|
Typescript Module | |||||||
Typescript Namespace |
| ||||||
Typescript Class |
| ||||||
Class Initializer |
| ||||||
Typescript Method |
| ||||||
Typescript Interface |
| ||||||
Typescript Function |
| ||||||
Angular Component | |||||||
Angular Directive | |||||||
Angular GET http service TypeScript GET http service | |||||||
Angular POST http service TypeScript POST http service | |||||||
Angular PUT http service TypeScript PUT http service | |||||||
Angular DELETE http service TypeScript DELETE http service | |||||||
HTML5 HTML fragment | |||||||
ReactJS Application | |||||||
ReactJS Component | |||||||
ReactJS Form | |||||||
Node.js Delete Operation Service | |||||||
Node.js Get Operation Service | |||||||
Node.js Post Operation Service | |||||||
Node.js Put Operation Service | |||||||
Node.js MongoDB connection | |||||||
Node.js MongoDB collection | |||||||
TypeScript SQL query | |||||||
Node.js AWS SQS Publisher | |||||||
Node.js AWS SQS Receiver | |||||||
Node.js AWS SQS Unknown Publisher | |||||||
Node.js AWS SQS Unknown Receiver | |||||||
Node.js AWS SNS Publisher | |||||||
Node.js | S3 RegionAWS SNS Subscriber | ||||||
Node.js | S3 BucketAWS SNS Unknown Publisher | ||||||
Node.js AWS Lambda Get Operation ServiceSNS Unknown Subscriber | |||||||
Node.js AWS Lambda Post Operation Service | |||||||
Node.js AWS Lambda Put Operation Service | |||||||
Node.js AWS Lambda Delete Operation Service | |||||||
Node.js AWS Lambda Any Operation Service | |||||||
Node.js AWS Lambda Function |
More about Typescript analysis
...
Support of arrow functions and methods
...
Node.js Call to Lambda | ||
Node.js Call to unknown Lambda | ||
Node.js S3 Bucket | ||
Node.js S3 Unknown Bucket |
More about Typescript analysis
Expand | |||
---|---|---|---|
Support of arrow functions and methodsArrow 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 functionsFor 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 ServicesXMLHttpRequestThe 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 :
fetchThe 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 :
|
...
Expand | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Web ServicesAngular web services are supported for both the older Http and new HttpClient (Angular ≥4.3) libraries. The method calls get, post, put, delete, jsonp, and request are recognized.Window variableThe 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:
a webservice object is created with the url set through the window variable: |
Anchor | ||||
---|---|---|---|---|
|
Expand | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Web ServicesAngular web services are supported for both the older Http and new HttpClient (Angular ≥4.3) libraries. The method calls get, post, put, delete, jsonp, and request are recognized.
The results of this code snippet are shown below.: Finally the use of the rxjs/ajax API as web service call is also supported. The different types of web services (GET, POST, PUT, DELELTEDELETE) are represented with the same Angular objects we have used above, despite they are not restricted to the Angular framework. Angular components and HTML fragmentsIn addition to the basic TypeScript objects the analyzer will generate specific objects and links for the Angular framework. In the following example, the analyser analyzer creates a TypeScript module object associated to with the file and a TypeScript class object associated to with the decorated class MyComponent. Angular components objects are created when finding special class decorators with the name Component. The view of Angular components is described in HTML language and the associated code can be either found in an external .html file or embedded in the decorator metadata.
For embedded data, the analyzer creates an HTML5 HTML Fragment belonging to the component, and will automatically generate a use (U) link between the Component and the HTML fragment: The generation of these links is necessary to describe the higher level call flow abstracted in the Angular framework and thus to retrieve transactions. Environment variablesIn our analysis, we consider a production deployment scenario. Thus we mimic the behavior of Angular when overloading behind-the-scenes the variables declared inside the exported environment dictionary defined in environment.ts by those defined in environment.prod.ts. Global variables might be used to connect different technology layers (via URLs for example), thus retrieving them correctly can be critical for full transactions. Latest The latest versions of Angular allows allow using many different production files. We only support a single production environment file, the standard environment.prod.ts. When using a no-production environment file a warning message will be logged.
Known limitations
|
More about React and React-Native framework analysis
Expand | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ReactJS ApplicationThis declaration will create a ReactJS application named App:Injection with useValueDependencies are services or objects that a class needs to perform its function. Dependency injection, or DI, is a design pattern in which a class requests dependencies from external sources rather than creating them. For instance, in the following, the Angular module provides an "environment" value.
ReactJS ComponentThis declaration will create a ReactJS component named Sequence because the class inherits from Component (a class which inherits from PureComponent would also induce the creation of a ReactJS component). A component must contain a render method. The render method is automatically called when the component is refered to in an HTML fragment:
ReactJS FormThis declaration will create a ReactJS form named contact:
This value can be accessed by other components through the constructor (note that the Type given to the "env" variable is the same as the one given in the provide key (see previous source code).
Analyzing the previous modules will create a web service with the URL given through injection: Known limitations
|
More about React and React-Native framework analysis
Expand | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ReactJS ApplicationThis declaration will create a ReactJS application named App:
ReactJS ComponentThis declaration will create a ReactJS component named Sequence because the class inherits from Component (a class that inherits from PureComponent would also induce the creation of a ReactJS component). A component must contain a render method. The render method is automatically called when the component is referred to in an HTML fragment:
HTML fragmentThis declaration will create a HTML fragment named render_fragment_1 starting with "<g>" and ending with "</g>". There can be several fragments in any function/method:
ReactJS FormThis declaration will create a ReactJS form named contact:
LinksLinks from the ReactJS applicationA relyon link is created from the application to theHTML fragmentof the application.Please remember that components are called mainly from html fragments, and render methods are implicitly called from ReactJS components. Links from a HTML fragmentHTML tags present in HTML fragments are linked to ReactJS components if they exist: Code Block | This declaration will create a HTML fragment named render_fragment_1 starting with "<g>" and ending with "</g>". There can be several fragments in any function/method:
HTML tags present in HTML fragments can also be linked to a Typescript function. HTML fragments are linked to functions or methods when they are represented between { ... }:
|
Node support
More about supported Nodejs built-in modules
Nodejs comes along with several built-in modules. Here is a description of the support we provide for some of these modules.
Http, Http2, Https modules
Expand | ||
---|---|---|
This extension currently supports the use of these modules for http requests from the client side only (i.e. the use of these modules as server is not yet supported). The analysis of the previous code will generate Node.js Get HttpRequest service object which is called by my_request function. A link between my_request function and the anonymous handler function is also added.
|
...
Expand | ||||||
---|---|---|---|---|---|---|
Nest (NestJS) is a framework for building Node.js server-side applications. Nest provides a level of abstraction above many common Node.js frameworks. The following features provided by nestjs are supported. ControllersA controller's purpose is to receive specific requests for the application. A controller is defined using a classe@ and decorators. The analysis of the following code will create a Node.js Get Operation named cats/all/ with a call link from the operation to the handler method findAll. The url corresponds to the concatenation of the argument of the @Controller decorator with that of the @Get decorator of the method. The decorator of each method defines the type of the operation
MiddlewaresMiddleware is a function which is called before the route handler. For instance in the following source code, the logger function will be called before each handler of the CatsController. Our analyzer will create a callLink between the operations defined in the CatsController and the logger.
HTTP moduleNestjs allows to perform http requests using the HTTP module. The analysis of the following source code will create a Node.js Get HttpRequest named foo/path/ with a call link from the findAll method to that request:
Known limitationsAll nestjs features which are not documented here are not supported. |
More about Express framework analysis
...
The analysis of the following code will create a Node.js Get Operation named /login with a call link from the operation to the handler function f:
Code Block |
---|
var app = express()
function f(req, res) {
console.log('login ' + req.url);
var currentSession = getSessionId(req, res);
}
app.get('/login', f); |
Routers are also supported and the analysis of the following code will create a Node.js Get Operation named /foo1/foo2:
Code Block |
---|
import express from 'express';
var router = express.Router()
// define the about route
router.get('/foo2', function (req, res) {
res.send('About birds')
})
var app = express()
app.use('/foo1', router) |
...
The analysis of the following code will create a Node.js Get Operation named /login/{} with a call link from the operation to the handler function f:
Code Block |
---|
import * as fastify from 'fastify'
function f(request, reply) {
reply.send({ hello: 'world' })
}
const server: fastify.FastifyInstance<Server, IncomingMessage, ServerResponse> = fastify({})
// Declare a route
server.get('/login/:name', f) |
Supported fastify methods are : get, put, post, delete, route
Known limitations
- prefix are not supported
- fastify-mongodb is not supported
More about request-promise, request-promise-native and request-promise-any frameworks
Expand | ||
---|---|---|
The analysis of the following code will create a Node.js Post HttpRequest named foo/post/ with a call link from my_func to that request:
|
...
LinksLinks from the ReactJS application
Please remember that components are called mainly from html fragments, and render methods are implicitly called from ReactJS components. Links from a HTML fragmentHTML tags present in HTML fragments are linked to ReactJS components if they exist:
HTML tags present in HTML fragments can also be linked to a Typescript function. HTML fragments are linked to functions or methods when they are represented between { ... }:
|
Node support
More about the support of custom node packages
Expand | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
It is possible to developp custom node packages. Apackageis a file or a directory that is described by a An application can combine mutliple packages. The packages can be built together using npm. npm adds these packages to a node_mudules directory. Note that the analyzer will skip everything which is inside a node_modules directory. Users should provide their custom packages at the root of the analyzed source code. Let's consider a package named my_proj. The root dir contains a package.json file which defines the project name.
Everything which is exported (or re-exported) from the my_proj/src/index.ts can be imported from any project which uses this package.
For instance when an other package uses this package, it can import the my_func function using the name of the package for the import:
When analyzing these source code, a callLink will be created between other_func and my_func: |
More about emailing services: nodemailer and sendgrid/mail
Expand | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
When analyzing the following source code, an email object is created with a callLink from the my_send_mail function
Similarly when analyzing the following source code, an email object is created with a callLink from the my_send_mail function:
|
More about supported Nodejs built-in modules
Nodejs comes along with several built-in modules. Here is a description of the support we provide for some of these modules.
Http, Http2, Https modules
Expand | ||
---|---|---|
This extension currently supports the use of these modules for http requests from the client-side only (i.e. the use of these modules as server is not yet supported). The analysis of the previous code will generate Node.js Get HttpRequest service object which is called by my_request function. A link between my_request function and the anonymous handler function is also added.
|
Anchor | ||||
---|---|---|---|---|
|
Expand | ||||||
---|---|---|---|---|---|---|
Nest (NestJS) is a framework for building Node.js server-side applications. Nest provides a level of abstraction above many common Node.js frameworks. The following features provided by nestjs are supported. ControllersA controller's purpose is to receive specific requests for the application. A controller is defined using a classe@ and decorators. The analysis of the following code will create a Node.js Get Operation named cats/all/ with a call link from the operation to the handler method findAll. The URL corresponds to the concatenation of the argument of the @Controller decorator with that of the @Get decorator of the method. The decorator of each method defines the type of the operation
MiddlewaresMiddleware is a function that is called before the route handler. For instance, in the following source code, the logger function will be called before each handler of the CatsController. Our analyzer will create a callLink between the operations defined in the CatsController and the logger.
HTTP moduleNestjs allows performing http requests using the HTTP module. The analysis of the following source code will create a Node.js Get HttpRequest named foo/path/ with a call link from the findAll method to that request:
Known limitationsAll nestjs features which are not documented here are not supported. |
More about Express framework analysis
Expand | ||
---|---|---|
The analysis of the following code will create a Node.js Put HttpRequest Get Operation named foo/put/login with a call link from my_func to that requestthe operation to the handler function f:
|
More about Sequelize framework analysis
Expand | |||
---|---|---|---|
In the following code:
Routers are also supported and the analysis of the following code will create a Node.js Get Operation named /foo1/foo2:
|
Anchor | ||||
---|---|---|---|---|
|
Expand | ||
---|---|---|
The analysis of the following code will create a Node.js Get Operation named /login/{} with a call link from the operation to the handler function f:
the User class defines a model which is linked with the table named 'users' (through the User.init() call). The name of the table is defined by the tableName value which if not defined is set to the pluralized (if freezeTableName is not set to true) value of modelName which is itself set to the class name when it is not explicitly defined. The User.findAll() call then selects elements from that table 'users'. In this example, this extension creates a useSelect link to the table 'users': Note that a model can also be defined using method sequelize.define(). |
...
Expand | ||||||
---|---|---|---|---|---|---|
ConnectionTypeORM can be used both with SQL and NoSQL databases. The database type is set through the connection option type :
The only NoSQL database which is supported by TypeORM is mongodb. A connection object is created by our analyzer only for mongodb databases. The name of the connection is the url mongodb://localhost/test which is constructed using the host and database values. An Entity is a class that maps to a database table (or collection when using MongoDB):
When a mongodb database is used, for each entity, the extension creates a MongoDB collection object. A parentLink between that collection and the corresponding connection is added. For an sql connection, the entity will be associated with the sql table having the same name (if that table exists). Link to table/collectionTypeORM provide several ways to access and/or update a table or collection. One can use an entity manager, a repository or a query builder. Here is an example with a repository:
Supported fastify methods are: get, put, post, delete, route Known limitations
|
More about request, request-promise, request-promise-native, and request-promise-any frameworks
Expand | ||
---|---|---|
The analysis of the following code will create a Node.js Post HttpRequest named foo/post/ with a call link from my_func to that request:
|
Similar support is provided for request, request-promise, and request-promise-any frameworks.
More about axios framework analysis
Expand | ||
---|---|---|
The analysis of the following code will create a Node.js Put HttpRequest named foo/put/ with a call link from my_func to that request:
|
More about Sequelize framework analysis
Expand | ||
---|---|---|
In the following code:
the User class defines a model which is linked with the table named 'users' (through the User.init() call). The name of the table is defined by the tableName value which if not defined is set to the pluralized (if freezeTableName is not set to true) value of modelName which is itself set to the class name when it is not explicitly defined. The User.findAll() call then selects elements from that table 'users'. In this example, this extension creates a useSelect link to the table 'users': Note that a model can also be defined using method sequelize.define(). |
Anchor | ||||
---|---|---|---|---|
|
Expand | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
ConnectionTypeORM can be used both with SQL and NoSQL databases. The database type is set through the connection option type :
Example for a mongodb database: both useSelect and useUpdate links are created between the update_user function and the User entity which belongs to the <Default> connection: Example for a sql database: both useSelect and useUpdate links are created between the update_user function and the user table. CascadesCascades are supported.
The only NoSQL database which is supported by TypeORM is mongodb. A connection object is created by our analyzer only for mongodb databases. The name of the connection is the URL mongodb://localhost/test which is constructed using the host and database values. An Entity is a class that maps to a database table (or collection when using MongoDB):
When the profile column of a user instance is saved, if the profile column of that instance was updated with a profile instance, that profile instance is also saved. Code Block | a mongodb database is used, for each entity, the extension creates a MongoDB collection object. A parentLink between that collection and the corresponding connection is added. For an SQL connection, the entity will be associated with the SQL table having the same name (if that table exists). Link to table/collectionTypeORM provide several ways to access and/or update a table or collection. One can use an entity manager, a repository, or a query builder. Here is an example with a repository:
In the previous example, a useUpdate link is create between the update_user function and both the user and profile tables/entities: SQL queriesPlain SQL queries can also be carried out using typeORM such as with the following code: Code Block |
Example for a mongodb database: both useSelect and useUpdate links are created between the update_user function and the User entity which belongs to the <Default> connection: Example for a SQL database: both useSelect and useUpdate links are created between the update_user function and the user table. CascadesCascades are supported.
In that example, a TypeScript query object is created and a callLink between the foo method and that query is added. The SQL Analyzer can then link that query with the corresponding table: Known limitationsThe following features are not supported
|
More about Mongoose and Mongodb frameworks analysis
See MongoDB support for Node.js source code.
Migration Issue when moving from com.castsoftawre.typescript 1.3.x to >= 1.4.x
Expand | |||||
---|---|---|---|---|---|
In 1.3.x, MongoDB Connection and MongoDB Collection objects were added to Typescript Module objects and when a connection (or a collection) is accessed using Mongoose from several files, the analyzer was creating one connection (or collection) object per such file. In order to avoid "added objects" and minimize the number of "deleted objects" when updating from 1.3.x to >=1.4.x a migration is carried out. This migration requires com.castsoftware.internal.platform version >= 0.8.5 to be used. Note that if the same connection (or collection) is accessed from different ts modules, when analyzing with com.castsoftware.typescript 1.3.x several MongoDB Connection (or MongoDB Collection) objects are created whereas only one object is created with
When the profile column of a user instance is saved, if the profile column of that instance was updated with a profile instance, that profile instance is also saved.
In the previous example, a useUpdate link is created between the update_user function and both the user and profile tables/entities: SQL queriesPlain SQL queries can also be carried out using typeORM such as with the following code:
In that example, a TypeScript query object is created and a callLink between the foo method and that query is added. The SQL Analyzer can then link that query with the corresponding table: Known limitationsThe following features are not supported
|
More about Mongoose and Mongodb frameworks analysis
See MongoDB support for Node.js source code.
Migration Issue when moving from com.castsoftawre.typescript 1.3.x to >= 1.4.x
Expand |
---|
In 1.3.x, MongoDB Connection and MongoDB Collection objects were added to Typescript Module objects and when a connection (or a collection) is accessed using Mongoose from several files, the analyzer was creating one connection (or collection) object per such file. |
...
Behavior explanation
Serverless framework, Serverless Application Model (SAM), and Cloudformation are supported. These are frameworks using *.yml or *.json file to set up AWS environment.
Whenever the runtime set in these files is nodejs, the com.castsoftware.nodejs extension is responsible for creating the corresponding NodeJS AWS Lambda Function, NodeJS AWS Lambda Operation (which represent AWS APIGateway events), and NodeJS AWS Simple Queue objects (see com.castsoftware.nodejs documentation for source codes and example).
Warning |
---|
Since the com.castsoftware.nodejs extension is responsible for analyzing AWS deployment framework *.yml and *.json files the results of an analysis will depend on the version of com.castsoftware.nodjes used. |
...
What results can you expect?
When analyzing the following source code with a recent enough version of com.castsoftware.nodejs (≥ 2.6.0.beta1):
Code Block |
---|
provider:
name: aws
runtime: nodejs12.x
functions:
mylambda:
handler: handler.apilambda
events:
- http:
path: test
method: get
- sqs:
arn:
Fn::GetAtt:
- MyQueue
- Arn
environment:
stage: ${opt:stage}
resources:
Resources:
MyQueue:
Type: "AWS::SQS::Queue"
Properties:
QueueName: "MyQueue" |
Assuming that the handler function is a TypeScript function, once the analysis/snapshot generation has completed, you can view the results in the normal manner (for example via CAST Enlighten):
Click to enlarge
...
Links
...
- createBucket
...
createMultipartUpload
createPresignedPost
abortMultipartUpload
completeMultipartUpload
deleteBucketAnalyticsConfiguration
deleteBucketCors
deleteBucketEncryption
deleteBucketInventoryConfiguration
deleteBucketLifecycle
deleteBucketMetricsConfiguration
deleteBucketPolicy
deleteBucketReplication
deleteBucketTagging
deleteBucketWebsite
deleteObjectTagging
deletePublicAccessBlock
getBucketAccelerateConfiguration
getBucketAcl
getBucketAnalyticsConfiguration
getBucketCors
getBucketEncryption
getBucketInventoryConfiguration
getBucketLifecycle
getBucketLifecycleConfiguration
getBucketLocation
getBucketLogging
getBucketMetricsConfiguration
getBucketNotification
getBucketNotificationConfiguration
getBucketPolicy
getBucketPolicyStatus
getBucketReplication
getBucketTagging
getBucketVersioning
getBucketWebsite
getObjectAcl
getObjectLegalHold
getObjectLockConfiguration
getObjectRetention
getObjectTagging
getPublicAccessBlock
getSignedUrl
- listBuckets
listBucketAnalyticsConfigurations
listBucketInventoryConfigurations
listBucketMetricsConfigurations
listMultipartUploads
listObjectVersions
listParts
- putBucketLogging
- putBucketAnalyticsConfiguration
putBucketLifecycleConfiguration
putBucketMetricsConfiguration
putBucketNotification
putBucketNotificationConfiguration
putBucketPolicy
putBucketReplication
putBucketRequestPayment
putBucketTagging
putBucketVersioning
putObjectAcl
putObjectLegalHold
putObjectLockConfiguration
putObjectRetention
putObjectTagging
putPublicAccessBlock
putBucketAccelerateConfiguration
putBucketAcl
putBucketCors
putBucketEncryption
putBucketInventoryConfiguration
putBucketLifecycle
upload
uploadPart
uploadPartCopy
...
- putObject
...
- deleteBucket
deleteObject
deleteObjects
...
- getObject
- getObjectTorrent
listObjects
listObjectsV2
...
- putBucketLogging
- putBucketAnalyticsConfiguration
Code samples
This code will create a S3 Bucket named "MyBucket" on an AWS server in region "REGION" and puts an object in it
Code Block | ||||
---|---|---|---|---|
| ||||
// Load the AWS SDK for Node.js
var AWS = require('aws-sdk');
// Set the region
AWS.config.update({region: 'REGION'});
// Create S3 service object
s3 = new AWS.S3({apiVersion: '2006-03-01'});
// Create the parameters for calling createBucket
var bucketParams = {
Bucket : "MyBucket",
ACL : 'public-read'
};
// call S3 to create the bucket
s3.createBucket(bucketParams, function(err, data) {
if (err) {
console.log("Error", err);
} else {
console.log("Success", data.Location);
}
});
params = {
// ...
Bucket: "MyBucket"
};
s3.putObject(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
}); |
What results can you expect?
Once the analysis/snapshot generation has completed, you can view the results in the normal manner (for example via CAST Enlighten):
Analysis of the code sample
...
Expand | ||||
---|---|---|---|---|
Links | ||||
Link Type | Function | |||
callLink |
| |||
Code Block | ||||
|
Anchor | ||||
---|---|---|---|---|
|
Anchor | ||||
---|---|---|---|---|
|
Expand |
---|
Behavior explanationLambda services allow executing some source code on the cloud and define when this source code should be executed. Lambda functions can be deployed using several deployment frameworks. The supported deployment frameworks are listed on this page. When a lambda function is created and its runtime is nodejs, the current extension is responsible for linking the lambda objects and their triggers with the TypeScript handler functions. ExampleLet us consider a source code defining a lambda function that has two triggers: an SQS queue and an API Gateway. The lambda function has a nodejs runtime and the handler function is given by the handler function fullname. If the lambda function is deployed using a supported deployment framework (such as CloudConfiguration), the analysis will create a lambda function, an SQS receiver, and an API Gateway objects. Each of these objects has a runtime property (nodejs) and a handler property with the function fullname. If the current extension finds a TypeScript method matching the handler fullname a link to that TypeScript method will be added from the lambda function, the SQS queue and the API Gateway objects: Click to enlarge |
Anchor | ||||
---|---|---|---|---|
|
Expand | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Links
Code samplesThis code will create an S3 Bucket named "MyBucket" on an AWS server in region "REGION" and puts an object in it
What results can you expect?Once the analysis/snapshot generation has completed, you can view the results in the normal manner (for example via CAST Enlighten): Analysis of the code sample |
Anchor SQSTypeScript SQSTypeScript
AWS SQS framework analysis
SQSTypeScript | |
SQSTypeScript |
Expand | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Links
Support for SDKThis code will publish a message into the "SQS_QUEUE_URL" queue:
This code will receive a message from the queue "SQS_QUEUE_URL"
What results can you expect?Once the analysis/snapshot generation has been completed, you can view the results in the standard manner (for example via CAST Enlighten): Click to enlarge When the evaluation of the queue name fails, a Node.js AWS SQS Unknown Publisher (or Receiver) will be created. |
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 samplesThis code will encapsulate AWS SDK then create a dynamoDB instance, and a Table instance.
This code will receive a message from the queue "SQS_QUEUE_URL"
What results can you expect? Once the analysis/snapshot generation has been completed, you can view the results in the normal manner with your favorite tool (for example via CAST Enlighten): Click to enlarge When the evaluation of the queue name fails, a Node.js AWS SQS Unknown Publisher (or Receiver) will be created.Analysis of the code sample |
Known limitations for AWS support
The use of AWS.SQS with promises is not supported. For instance, no link would be created between the receiver and the handler function defined in .then() call in the following source code:
Code Block language xml this.sqs.receiveMessage(params).promise().then( () => {})
- If the queueName is set using the createQueue apiAPI, the evaluation of the queue name will fail.
...
Expand | ||
---|---|---|
In the following code:
In this example, a TypeScript query object is created and a callLink between the anonymous function and that query is added. The sql analyzer can then link that query with the corresponding table if the table exists. In the present case, this extension creates a useSelect link to the table 'titles': |
Links
Analysis of the TypeScript application will result in the following links:
- callLink: Created when a method or a function is called. These links connect TypeScript Method and TypeScript Function elements between them.
- inheritLink: Represents direct inheritance between TypeScript Class and TypeScript Interface objects.
...
In this example, a TypeScript query object is created and a callLink between the anonymous function and that query is added. The sql analyzer can then link that query with the corresponding table if the table exists. In the present case, this extension creates a useSelect link to the table 'titles': |
Links
Analysis of the TypeScript application will result in the following links:
- callLink: Created when a method or a function is called. These links connect TypeScript Method and TypeScript Function elements between them.
- inheritLink: Represents direct inheritance between TypeScript Class and TypeScript Interface objects.
Anchor | ||||
---|---|---|---|---|
|
The following rules are shipped with this extension:
...
Info |
---|
The rule "Avoid too many copy-pasted artifacts" depends on com.castsoftware.html5 extension. It will be activated automatically for TypeScript source code when using a version of com.castsoftware.html5 >= 2.0.15-funcrel. |
...
- Limitations for support of the following frameworks are given in their own section: Use
- Calls between JavaScript and TypeScript source codes are not supported.
- The use of setters and getters is not supported.
- Passing directly url strings Passing the URL strings directly (or string variables referring to urlsURLs) as arguments to web-service calls is supported for many use cases. However, passing them through http.RequestOptions (containing metadata) is work in progress.
- String concatenations using the operator '+' inside loops does do not raise violations currently.
- The cyclomatic complexity number might appear underestimated in callables containing loops with complex conditional expressions.
- A single production environment file is supported (see corresponding section above).
- Use The use of bind method is not supported and would lead to missing callLinks.
- Use The use of Object.freeze method is not supported.
- React Without JSX is not supported.
- The spread operator "..." is not supported.