New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@cpmech/az-cdk

Package Overview
Dependencies
Maintainers
1
Versions
207
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cpmech/az-cdk - npm Package Compare versions

Comparing version 0.4.4 to 0.5.0

2

dist/index.d.ts

@@ -7,2 +7,2 @@ export { ReceiveEmailSQSConstruct } from './constructs/receive-email-sqs-construct';

export { synthApp, synthAppString } from './synthApp';
export { synthAppExternal, findApiResourceId, getApiUrl, findApiUrl } from './parseTemplate';
export { synthAppExternal, findResourceId, getPhysicalId, findApiUrl, findQueueUrl, } from './parseTemplate';

@@ -251,13 +251,15 @@ 'use strict';

};
// findApiResourceId finds (logical) resource id in Resources data from template.yml
const findApiResourceId = (resources) => {
// findResourceId finds (logical) resource id in Resources data from template.yml
// resourceType: e.g. AWS::ApiGateway::RestApi, AWS::SQS::Queue
const findResourceId = (resources, resourceType) => {
for (const [key, value] of Object.entries(resources)) {
if (value.Type === 'AWS::ApiGateway::RestApi') {
if (value.Type === resourceType) {
return key;
}
}
return '';
throw new Error(`cannot find resource ${resourceType}`);
};
// getApiUrl calls aws describe-stack-resources to find the physical id of API Gateway and then returns the URL
const getApiUrl = async (stackName, resourceId, stage = 'prod', region = 'us-east-1') => {
// getPhysicalId calls aws describe-stack-resources to find the physical id of a resource within a stack
// resourceId is the logical resource ID
const getPhysicalId = async (stackName, resourceId) => {
const res = await basic.runCmd('aws', [

@@ -273,11 +275,19 @@ 'cloudformation',

const physicalId = data.StackResources[0].PhysicalResourceId;
return `https://${physicalId}.execute-api.${region}.amazonaws.com/${stage}`;
return physicalId;
};
// findApiUrl finds the API Gateway url (by generating the template and calling the aws sdk)
// e.g. synthAppExternal('cdk-service') where 'cdk-service' is the 'scripts' command in package.json
const findApiUrl = async (stackName, packageJsonScriptsCommand, stage = 'prod', region = 'us-east-1') => {
const res = await synthAppExternal(packageJsonScriptsCommand);
const id = findApiResourceId(res);
return await getApiUrl(stackName, id, stage, region);
const resourceId = findResourceId(res, 'AWS::ApiGateway::RestApi');
const physicalId = await getPhysicalId(stackName, resourceId);
return `https://${physicalId}.execute-api.${region}.amazonaws.com/${stage}`;
};
// findQueueUrl finds the Queue url (by generating the template and calling the aws sdk)
// TODO: find a confirmation that the PhysicalId will always be equal to the URL
const findQueueUrl = async (stackName, packageJsonScriptsCommand) => {
const res = await synthAppExternal(packageJsonScriptsCommand);
const resourceId = findResourceId(res, 'AWS::SQS::Queue');
const physicalId = await getPhysicalId(stackName, resourceId);
return physicalId;
};

@@ -288,5 +298,6 @@ exports.LambdaApiConstruct = LambdaApiConstruct;

exports.ReceiveEmailSQSConstruct = ReceiveEmailSQSConstruct;
exports.findApiResourceId = findApiResourceId;
exports.findApiUrl = findApiUrl;
exports.getApiUrl = getApiUrl;
exports.findQueueUrl = findQueueUrl;
exports.findResourceId = findResourceId;
exports.getPhysicalId = getPhysicalId;
exports.refParam = refParam;

@@ -293,0 +304,0 @@ exports.synthApp = synthApp;

import { Iany } from '@cpmech/basic';
export declare const synthAppExternal: (packageJsonScriptsCommand: string) => Promise<Iany>;
export declare const findApiResourceId: (resources: any) => string;
export declare const getApiUrl: (stackName: string, resourceId: string, stage?: string, region?: string) => Promise<string>;
export declare const findResourceId: (resources: any, resourceType: string) => string;
export declare const getPhysicalId: (stackName: string, resourceId: string) => Promise<string>;
export declare const findApiUrl: (stackName: string, packageJsonScriptsCommand: string, stage?: string, region?: string) => Promise<string>;
export declare const findQueueUrl: (stackName: string, packageJsonScriptsCommand: string) => Promise<string>;
{
"name": "@cpmech/az-cdk",
"version": "0.4.4",
"version": "0.5.0",
"license": "MIT",

@@ -32,3 +32,3 @@ "author": {

"@types/node": "^12.0.12",
"aws-cdk": "^0.36.2",
"aws-cdk": "^0.37.0",
"dotenv": "^8.0.0",

@@ -38,3 +38,3 @@ "jest": "^24.8.0",

"prettier": "^1.18.2",
"rollup": "^1.16.4",
"rollup": "^1.16.6",
"rollup-plugin-node-resolve": "^5.2.0",

@@ -49,15 +49,15 @@ "rollup-plugin-typescript2": "^0.21.2",

"dependencies": {
"@aws-cdk/aws-apigateway": "^0.36.2",
"@aws-cdk/aws-codebuild": "^0.36.2",
"@aws-cdk/aws-codepipeline": "^0.36.2",
"@aws-cdk/aws-codepipeline-actions": "^0.36.2",
"@aws-cdk/aws-iam": "^0.36.2",
"@aws-cdk/aws-lambda": "^0.36.2",
"@aws-cdk/aws-ses": "^0.36.2",
"@aws-cdk/aws-sns": "^0.36.2",
"@aws-cdk/aws-sns-subscriptions": "^0.36.2",
"@aws-cdk/aws-sqs": "^0.36.2",
"@aws-cdk/core": "^0.36.2",
"@cpmech/basic": "^0.3.2"
"@aws-cdk/aws-apigateway": "^0.37.0",
"@aws-cdk/aws-codebuild": "^0.37.0",
"@aws-cdk/aws-codepipeline": "^0.37.0",
"@aws-cdk/aws-codepipeline-actions": "^0.37.0",
"@aws-cdk/aws-iam": "^0.37.0",
"@aws-cdk/aws-lambda": "^0.37.0",
"@aws-cdk/aws-ses": "^0.37.0",
"@aws-cdk/aws-sns": "^0.37.0",
"@aws-cdk/aws-sns-subscriptions": "^0.37.0",
"@aws-cdk/aws-sqs": "^0.37.0",
"@aws-cdk/core": "^0.37.0",
"@cpmech/basic": "^0.4.0"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc