# @dronedeploy/dronedeploy-cli

> This plugin enables support for DroneDeploy within the Serverless Framework

Latest version **2.2.0** (published 2024-04-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @dronedeploy/dronedeploy-cli
pnpm add @dronedeploy/dronedeploy-cli
yarn add @dronedeploy/dronedeploy-cli
bun add @dronedeploy/dronedeploy-cli
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2024-04-24 |
| First published | 2018-08-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10.x |
| Dependencies | 19 |
| Unpacked size | 245.9 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | The DroneDeploy Team |
| Maintainers | dronedeploy-user, dronedeploy-ops |

## Links

- npm: https://www.npmjs.com/package/@dronedeploy/dronedeploy-cli
- Repository: https://github.com/dronedeploy/serverless-dronedeploy
- Homepage: https://github.com/dronedeploy/serverless-dronedeploy#readme
- Issues: https://github.com/dronedeploy/serverless-dronedeploy/issues
- npm.io page: https://npm.io/package/@dronedeploy/dronedeploy-cli

## Dependencies (19)

- [test](https://npm.io/package/test.md) ^0.6.0
- [chalk](https://npm.io/package/chalk.md) ^2.4.1
- [netrc](https://npm.io/package/netrc.md) ~0.1.4
- [lodash](https://npm.io/package/lodash.md) ^4.17.15
- [aws-sdk](https://npm.io/package/aws-sdk.md) ^2.1049.0
- [envfile](https://npm.io/package/envfile.md) 2.3.0
- [js-yaml](https://npm.io/package/js-yaml.md) ^3.12.0
- [shelljs](https://npm.io/package/shelljs.md) ^0.8.2
- [archiver](https://npm.io/package/archiver.md) 3.1.1
- [bluebird](https://npm.io/package/bluebird.md) ~3.0.6
- [fs-extra](https://npm.io/package/fs-extra.md) 7.0.0
- [readline](https://npm.io/package/readline.md) ~1.3.0
- [cli-table](https://npm.io/package/cli-table.md) ~0.3.1
- [copyfiles](https://npm.io/package/copyfiles.md) 2.4.1
- [jsonschema](https://npm.io/package/jsonschema.md) ^1.2.4
- [node-fetch](https://npm.io/package/node-fetch.md) ~2.6.1
- [child_process](https://npm.io/package/child_process.md) ^1.0.2
- [camelcase-keys](https://npm.io/package/camelcase-keys.md) 4.2.0
- [@ungap/url-search-params](https://npm.io/package/@ungap/url-search-params.md) 0.1.4

## Recent versions

- 2.2.0 (latest) — 2024-04-24
- 2.1.3 — 2024-01-11
- 2.1.2 — 2023-05-16
- 2.1.1 — 2022-12-28
- 2.1.0 — 2022-08-04
- 2.0.0 — 2022-07-05
- 1.7.7 — 2022-06-22
- 1.7.6 — 2022-04-01
- 1.7.5 — 2022-01-19
- 1.7.4 — 2022-01-17
- 1.7.3 — 2022-01-17
- 1.7.2 — 2022-01-12
- 1.7.1 — 2021-12-20
- 1.7.0 — 2021-03-12
- 1.6.5 — 2021-02-12
- … 29 more at https://npm.io/package/@dronedeploy/dronedeploy-cli/versions

## README

<img src="dd_logo.png" alt="DroneDeploy logo" title="DroneDeploy App Platform" align="right" height="96" width="96"/>

# serverless-dronedeploy

The DroneDeploy provider implementaion for the Serverless Framework.

## Prerequisites

1. [Create](https://www.dronedeploy.com/signup.html) a DroneDeploy account
1. Become a DroneDeploy developer (see account settings on the DroneDeploy site)
1. Obtain a DroneDeploy developer API key

    Contact appmarket@dronedeploy.com and ask for a developer API key

1. Take a look at our [example apps](https://github.com/dronedeploy/app-examples)

## Quick start

1. Install the Serverless Framework

        npm install -g serverless

2. Create new service with the `IFTTT` application template

        serverless create --name test-service --template-url "https://github.com/dronedeploy/app-examples/tree/master/IFTTT"

    If you have the template repository already cloned locally use this command
    to create service

        serverless create --name test-service --template-path "<path to app-examples>/IFTTT"

3. Install dependencies

        cd test-service
        npm install

4. Sign in to DroneDeploy with your api key

        serverless config dronedeploy-credentials --provider=dronedeploy --key=<YOUR API KEY>

5. Update `serverless.yml` with your app's id or create new app with

        serverless deploy app --name "my app name"

   This will automatically insert new app id into the configuration file.

6. Modify `serverless.yml` and `index.js` according to your needs.
7. Deploy all your functions

        serverless deploy

   or deploy a single selected function

        serverless deploy --function <function name>

## DroneDeploy serverless.yml

### Functions configuration

Functions deployment via DroneDeploy provider requires additional fields in
`serverless.yml` file. Typical structure of `functions` block should look like
this:

    app: my-app-id
    functions:
      helloWorld:
        handler: helloWorld


where the top level `app` field should point to your DroneDeploy app's id and
key mapping for the function should be a unique string among your deployed
functions for the app.

Additionally, you can pass a `timeout`(min: `30s`, max: `540s`) field. By
default, `timeout = 60s`.

#### Configuration with functions sub-folders

Often, it is useful to organize multiple functions into sub-folders to keep
the directory structure clean. The configuration can support this, while still
keeping the `serverless.yml` at the top-level folder. When this is done, a path
to the function(s) **must** be specified in `serverless.yml`.

Extending the snippet above, if the `helloWorld` function were located in a
sub-folder `functions/hello`, the function configuration would look like this:

    app: my-app-id
    functions:
      helloWorld:
        handlerPath: functions/hello
        handler: helloWorld

### Datastore configuration

DroneDeploy functions can make use of SQL style tables via the Datastore API.
These tables can be defined in `serverless.yml` to make setup and configuration
very easy.

This is done by adding a `resources` section to a function definition and then
defining the `tables` and `columns` needed.

For example, and OAuth function might want to store the token data in order to
determine access without making a new authorization request every time.

    app: my-app-id
    functions:
      oauth:
        handlerPath: function/oauth
        handler: oauth
        resources:
          tables:
            token-table:
              description: table to store token data
              columns:
                - name: accessToken
                  type: Text
                  encrypted: true
                  length: 255
                  description: Holds the OAuth access token
                - name: expiresAt
                  type: DateTime
                  description: The date and time that the token expires
                - name: refreshToken
                  type: Text
                  encrypted: true
                  length: 255
                  description: Holds the OAuth refresh token

Tables common to all defined functions can be defined by placing the `resources`
property with the table definitions at the root level in `serverless.yml` (same
level as the `functions` property):

    app: my-app-id
    functions:
      ...
    resources:
      tables:
        table-1-name:
          ...
        table-2-name:
          ...

Valid Datastore column types include:
- Integer
- Float
- Date
- DateTime
- Email
- Text

For `Text` column types, two additional properties are available:
- `encrypted`: Encrypts if the column data if true
- `length`: Length of text allowed in the column, defaults to 255

### Triggers configuration

DroneDeploy Functions can take action based on different events that occur in
the DroneDeploy platform. These are called Triggers. For example, if you want a
function to run once an Export operation has finished, a Trigger can be
configured for Export Complete.

The following is an example of how to configure a trigger for a particular
function:

    app: my-app-id
    functions:
      my-example:
        handlerPath: functions/example
        handler: exportComplete
        events:
          - trigger:
              object-type: Export
              type: complete

Multiple triggers may also be configured for a single function if desired. This
can be done with the following syntax:

    app: my-app-id
    functions:
      my-example:
        handlerPath: functions/example
        handler: processComplete
        events:
          - trigger:
              object-type: Export
              type: complete
          - trigger:
              object-type: MapPlan
              type: complete

The following Event Object Types and Event Types are currently supported by the
DroneDeploy platform:

Event Object Type (Event Type):
- Export (complete)
- MapPlan (complete)

#### How to use DroneDeploy Triggers

As we are currently in Beta release and things are subject to change, for now,
in order to have your function execute on the defined trigger, you **_MUST_**
define a handler in your function code.

The handler is for the `__ddfunctiontrigger` route, and when called by the
DroneDeploy platform, should execute the desired code in response to the event.

An example of this can be found in the [code for the IFTTT app](https://github.com/dronedeploy/app-examples/blob/f62d62b8ecd5fa090b24c16aa755aeb8f86080e8/IFTTT/functions/webhook/handler.js#L170)
as seen in our [Getting Started Guide](https://developer.dronedeploy.com/docs/sdk-beta/getting-started.html)

### DroneDeploy help commands

Get help for all available commands:

    sls help

Get help for specific command:

    sls <command> --help

## Contributing

Contributions are welcome! Please make a pull request on this repository.

## License

MIT

See [LICENSE](LICENSE)

---
_Source: https://npm.io/package/@dronedeploy/dronedeploy-cli · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
