How to use the @serverless/utils.not function in @serverless/utils

To help you get started, we’ve selected a few @serverless/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github serverless / components / registry / AwsApiGateway / src / index.js View on Github external
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'
      }
    }
github serverless / components / registry / AwsS3Website / src / index.js View on Github external
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'
      }
    }
github serverless / components / registry / AwsSnsSubscription / src / index.js View on Github external
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
    }
github serverless / components / registry / AwsSnsTopic / src / index.js View on Github external
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
    }
github serverless / components / registry / Service / src / index.js View on Github external
code = map((codeItem) => {
      if (isString(codeItem) && not(path.isAbsolute(codeItem))) {
        return path.resolve(root, codeItem)
      }
      return codeItem
    }, code)
  }
github serverless / components / registry / AwsLambdaLayerVersion / src / index.js View on Github external
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'
      }
    }
github serverless / components / registry / AwsSnsSubscription / src / index.js View on Github external
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
    }
github serverless / components / registry / AwsDynamoDb / src / index.js View on Github external
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'
      }
    }
github serverless / components / registry / AwsSnsTopic / src / index.js View on Github external
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
    }