Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async shouldDeploy(prevInstance) {
const inputs = {
stage: this.stage,
swaggerTemplate: this.swaggerTemplate
}
const prevInputs = prevInstance ? pick(keys(inputs), prevInstance) : {}
const configChanged = not(equals(inputs, prevInputs))
// Eslam:
// interestingly, there's no replace for APIG!
// because the user cannot change the rest api id
// he can only change the name, in which case AWS would do the "replace"
if (!prevInstance || configChanged) {
return 'deploy'
}
}
this.hash = await hashProjectDir(this.projectDir)
const inputs = {
bucket: this.bucket,
projectDir: this.projectDir,
assets: this.assets,
envFileLocation: this.envFileLocation,
hash: this.hash,
env: this.env,
buildCmd: this.buildCmd
}
// set the domain so that it's accessible in the `info` function
this.domain = `${this.bucket}.s3-website-${this.provider.region}.amazonaws.com`
const prevInputs = prevInstance ? pick(keys(inputs), prevInstance) : {}
const configChanged = not(equals(prevInputs, inputs))
if (prevInstance && prevInstance.bucket !== this.bucket) {
return 'replace'
} else if (!prevInstance || configChanged) {
return 'deploy'
}
}
shouldDeploy(prevInstance) {
if (!prevInstance) {
return 'deploy'
}
const inputs = {
topic: this.topic,
protocol: this.protocol,
endpoint: this.endpoint,
subscriptionAttributes: this.subscriptionAttributes
}
const prevInputs = prevInstance ? pick(keys(inputs), prevInstance) : {}
const configChanged = not(equals(inputs, prevInputs))
if (
not(equals(prevInstance.protocol, inputs.protocol)) ||
not(equals(prevInstance.topic, inputs.topic))
) {
return 'replace'
} else if (configChanged) {
return 'deploy'
}
return undefined
}
shouldDeploy(prevInstance) {
if (!prevInstance) {
return 'deploy'
}
const inputs = {
topicName: this.topicName,
displayName: this.displayName,
policy: this.policy,
deliveryPolicy: this.deliveryPolicy,
deliveryStatusAttributes: this.deliveryStatusAttributes
}
const prevInputs = prevInstance ? pick(keys(inputs), prevInstance) : {}
const configChanged = not(equals(inputs, prevInputs))
if (not(equals(prevInstance.topicName, inputs.topicName))) {
return 'replace'
} else if (configChanged) {
return 'deploy'
}
return undefined
}
code = map((codeItem) => {
if (isString(codeItem) && not(path.isAbsolute(codeItem))) {
return path.resolve(root, codeItem)
}
return codeItem
}, code)
}
if (isArchivePath(this.content)) {
this.zip = await readFile(this.content)
} else {
await this.pack(context)
}
const hash = crypto.createHash('sha256')
hash.update(this.zip)
this.hash = hash.digest('base64')
const currentConfig = pick(
['layerName', 'layerDescription', 'content', 'compatibleRuntimes', 'licenseInfo', 'hash'],
this
)
const prevConfig = prevInstance ? pick(keys(currentConfig), prevInstance) : {}
const configChanged = not(equals(currentConfig, prevConfig))
if (
prevInstance &&
((this.retain === false && configChanged) ||
(prevInstance.layerName !== currentConfig.layerName && this.retain !== true))
) {
return 'replace'
} else if (!prevInstance || configChanged) {
return 'deploy'
}
}
shouldDeploy(prevInstance) {
if (!prevInstance) {
return 'deploy'
}
const inputs = {
topic: this.topic,
protocol: this.protocol,
endpoint: this.endpoint,
subscriptionAttributes: this.subscriptionAttributes
}
const prevInputs = prevInstance ? pick(keys(inputs), prevInstance) : {}
const configChanged = not(equals(inputs, prevInputs))
if (
not(equals(prevInstance.protocol, inputs.protocol)) ||
not(equals(prevInstance.topic, inputs.topic))
) {
return 'replace'
} else if (configChanged) {
return 'deploy'
}
return undefined
}
shouldDeploy(prevInstance) {
const inputs = {
attributeDefinitions: this.attributeDefinitions,
provisionedThroughput: this.provisionedThroughput,
globalSecondaryIndexes: this.globalSecondaryIndexes,
sseSpecification: this.sseSpecification,
streamSpecification: this.streamSpecification,
timeToLiveSpecification: this.timeToLiveSpecification
}
const prevInputs = prevInstance ? pick(keys(inputs), prevInstance) : {}
const configChanged = not(equals(inputs, prevInputs))
if (!prevInstance || configChanged) {
return 'deploy'
} else if (
prevInstance.tableName !== this.tableName ||
not(equals(prevInstance.keySchema, this.keySchema))
) {
return 'replace'
}
}
shouldDeploy(prevInstance) {
if (!prevInstance) {
return 'deploy'
}
const inputs = {
topicName: this.topicName,
displayName: this.displayName,
policy: this.policy,
deliveryPolicy: this.deliveryPolicy,
deliveryStatusAttributes: this.deliveryStatusAttributes
}
const prevInputs = prevInstance ? pick(keys(inputs), prevInstance) : {}
const configChanged = not(equals(inputs, prevInputs))
if (not(equals(prevInstance.topicName, inputs.topicName))) {
return 'replace'
} else if (configChanged) {
return 'deploy'
}
return undefined
}