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

@serverless-contracts/plugin

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@serverless-contracts/plugin

A plugin to safely deploy Serverless microservices.

  • 0.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

@serverless-contracts/plugin

A plugin to safely deploy Serverless microservices.

This plugin is part of the serverless-contracts project. See its documentation for more insights.

Installation

npm install @serverless-contracts/plugin --save-dev

Or if you're using yarn

yarn add -D @serverless-contracts/plugin

Then in your serverless.ts file, add @serverless-contracts/plugin to the list of your plugins.

Configuration

Add a contracts key to your Serverless file:


import { myFirstContract, mySecondContract } from 'my-contracts-package';
import { consumedContract } from 'other-contracts';

const serverlessConfigation = {
    service: 'my-app',
    provider: {
        name: aws
    },
    plugins: ['@serverless-contracts/plugin'],
    functions: {
        ...
    },
    contracts: {
        provides: {
            myFirstContract: myFirstContract.fullContractSchema,
            mySecondContract: mySecondContract.fullContractSchema
        },
        consumes: {
            consumedContract: consumedContract.fullContractSchema,
        },
    },
}

Where all the contracts are defined using serverless-contracts.

Commands

  • serverless localContracts: prints the local version of the contracts
  • serverless remoteContracts: prints the currently deployed version of the contracts
  • serverless safeDeploy --strategy <strategy>: a wrapper around the deploy command of the Serverless Framework, check if the contracts modification is deployable with the chosen strategy. Choices are PROVIDER_FIRST or CONSUMER_FIRST

Typing

This plugin exposes its own types. In order to properly type your Serverless service file:

import { ServerlessContracts } from '@serverless-contracts/plugin';
import { AWS } from '@serverless/typescript';

const serverlessConfiguration: AWS & ServerlessContracts = {
    ...
}

Keywords

FAQs

Package last updated on 28 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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