Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@collaborne/custom-cloudformation-resources

Package Overview
Dependencies
Maintainers
4
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@collaborne/custom-cloudformation-resources - npm Package Compare versions

Comparing version 0.5.3 to 0.5.4

16

dist/custom-resource.js

@@ -7,2 +7,5 @@ "use strict";

const cfn_response_1 = require("./cfn-response");
const {
/** ARN of the role to use with CloudWatch Events */
CW_EVENTS_CONTINUATION_RULE_ROLE_ARN, CW_EVENTS_CONTINUATION_TARGET_ROLE_ARN, } = process.env;
function isContinuationRequired(response) {

@@ -115,4 +118,4 @@ return typeof response === 'object' && 'continuationAfter' in response;

const continuationRuleName = this.getContinuationRuleName(request);
// XXX: Magic! Needs to be documented that this can be set to an ARN of the role to use.
const ruleRoleArn = process.env.CW_EVENTS_CONTINUATION_RULE_ROLE_ARN;
const ruleRoleArn = CW_EVENTS_CONTINUATION_RULE_ROLE_ARN;
const targetRoleArn = CW_EVENTS_CONTINUATION_TARGET_ROLE_ARN;
// Ideally we want to put the target for the continuation first so that we don't miss

@@ -142,3 +145,3 @@ // our own goal, but CWE doesn't work this way.

}),
RoleArn: process.env.CW_EVENTS_CONTINUATION_TARGET_ROLE_ARN,
RoleArn: targetRoleArn,
},

@@ -150,4 +153,7 @@ ],

const when = new Date(now.getTime() + continuationAfter * 1000);
// Round up to the next full minute, as we won't be getting scheduling if the time isn't in the future.
const cronExpression = `${Math.max(now.getMinutes() + 1, when.getMinutes())} ${when.getHours()} ${when.getDate()} ${when.getMonth() + 1} ? ${when.getFullYear()}`;
// Build a cron expression for CWE
// - We must use GMT
// - We must round up to the next full minute, as we won't be getting scheduling if the time isn't in the future.
// See also https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html
const cronExpression = `${Math.max(now.getUTCMinutes() + 1, when.getUTCMinutes())} ${when.getUTCHours()} ${when.getUTCDate()} ${when.getUTCMonth() + 1} ? ${when.getUTCFullYear()}`;
this.logger.log(`Scheduling continuation using CWE rule ${continuationRuleName} after ${continuationAfter}s (at ${cronExpression})`);

@@ -154,0 +160,0 @@ const schedulePutRuleParams = {

{
"name": "@collaborne/custom-cloudformation-resources",
"version": "0.5.3",
"version": "0.5.4",
"description": "Custom CloudFormation resources",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -13,2 +13,8 @@ import { CloudWatchEvents } from 'aws-sdk';

const {
/** ARN of the role to use with CloudWatch Events */
CW_EVENTS_CONTINUATION_RULE_ROLE_ARN,
CW_EVENTS_CONTINUATION_TARGET_ROLE_ARN,
} = process.env;
export interface Response<ResourceAttributes extends unknown> {

@@ -233,4 +239,4 @@ physicalResourceId?: string;

// XXX: Magic! Needs to be documented that this can be set to an ARN of the role to use.
const ruleRoleArn = process.env.CW_EVENTS_CONTINUATION_RULE_ROLE_ARN;
const ruleRoleArn = CW_EVENTS_CONTINUATION_RULE_ROLE_ARN;
const targetRoleArn = CW_EVENTS_CONTINUATION_TARGET_ROLE_ARN;

@@ -262,3 +268,3 @@ // Ideally we want to put the target for the continuation first so that we don't miss

}),
RoleArn: process.env.CW_EVENTS_CONTINUATION_TARGET_ROLE_ARN,
RoleArn: targetRoleArn,
},

@@ -271,9 +277,13 @@ ],

const when = new Date(now.getTime() + continuationAfter * 1000);
// Round up to the next full minute, as we won't be getting scheduling if the time isn't in the future.
// Build a cron expression for CWE
// - We must use GMT
// - We must round up to the next full minute, as we won't be getting scheduling if the time isn't in the future.
// See also https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html
const cronExpression = `${Math.max(
now.getMinutes() + 1,
when.getMinutes(),
)} ${when.getHours()} ${when.getDate()} ${
when.getMonth() + 1
} ? ${when.getFullYear()}`;
now.getUTCMinutes() + 1,
when.getUTCMinutes(),
)} ${when.getUTCHours()} ${when.getUTCDate()} ${
when.getUTCMonth() + 1
} ? ${when.getUTCFullYear()}`;

@@ -280,0 +290,0 @@ this.logger.log(

Sorry, the diff of this file is not supported yet

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