# @softchef/cdk-schedule-function

> Manageable schedule to invoke lambda functions

Latest version **2.0.94** (published 2022-08-09) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @softchef/cdk-schedule-function
pnpm add @softchef/cdk-schedule-function
yarn add @softchef/cdk-schedule-function
bun add @softchef/cdk-schedule-function
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; large bundle.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.94 |
| Published | 2022-08-09 |
| First published | 2021-06-28 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 12 |
| Unpacked size | 29.2 MB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | SoftChef |
| Maintainers | softchef-iot-lab |
| Keywords | cdk, events, function, lambda, schedule |

## Links

- npm: https://www.npmjs.com/package/@softchef/cdk-schedule-function
- Repository: https://github.com/softchef/cdk-schedule-function
- Homepage: https://github.com/softchef/cdk-schedule-function#readme
- Issues: https://github.com/softchef/cdk-schedule-function/issues
- npm.io page: https://npm.io/package/@softchef/cdk-schedule-function

## Dependencies (12)

- [joi](https://npm.io/package/joi.md) ^17.6.0
- [uuid](https://npm.io/package/uuid.md) ^8.3.2
- [dayjs](https://npm.io/package/dayjs.md) ^1.11.4
- [@types/uuid](https://npm.io/package/@types/uuid.md) ^8.3.4
- [@aws-sdk/client-s3](https://npm.io/package/@aws-sdk/client-s3.md) ^3.145.0
- [@aws-sdk/lib-dynamodb](https://npm.io/package/@aws-sdk/lib-dynamodb.md) ^3.145.0
- [@softchef/cdk-restapi](https://npm.io/package/@softchef/cdk-restapi.md) ^2.0.181
- [@aws-sdk/client-lambda](https://npm.io/package/@aws-sdk/client-lambda.md) ^3.145.0
- [@aws-sdk/util-dynamodb](https://npm.io/package/@aws-sdk/util-dynamodb.md) ^3.145.0
- [@softchef/lambda-events](https://npm.io/package/@softchef/lambda-events.md) ^0.0.8
- [@aws-sdk/client-dynamodb](https://npm.io/package/@aws-sdk/client-dynamodb.md) ^3.145.0
- [@aws-sdk/client-eventbridge](https://npm.io/package/@aws-sdk/client-eventbridge.md) ^3.145.0

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 2.0.94 (latest) — 2022-08-09
- 1.0.1 (cdkv1) — 2022-04-27
- 2.0.93 — 2022-08-08
- 2.0.92 — 2022-08-07
- 2.0.91 — 2022-08-06
- 2.0.90 — 2022-08-05
- 2.0.89 — 2022-08-04
- 2.0.88 — 2022-08-03
- 2.0.87 — 2022-08-02
- 2.0.86 — 2022-08-01
- 2.0.85 — 2022-07-31
- 2.0.84 — 2022-07-30
- 2.0.83 — 2022-07-29
- 2.0.82 — 2022-07-28
- 2.0.81 — 2022-07-27
- … 194 more at https://npm.io/package/@softchef/cdk-schedule-function/versions

## README

# CDK Construct - Schedule Function

[![npm version](https://badge.fury.io/js/%40softchef%2Fcdk-schedule-function.svg)](https://badge.fury.io/js/%40softchef%2Fcdk-schedule-function)
![Release](https://github.com/SoftChef/cdk-schedule-function/workflows/Release/badge.svg)
![npm](https://img.shields.io/npm/dt/@softchef/cdk-schedule-function?label=NPM%20Downloads&color=orange)

ScheduleFunction is CDK Construct, provide lambda functions to manage your schedule with Amazon EventBridge service. It is arrange one-time or multi-times schedule to invoke specify lambda functions. It is not permanent recurly, because you can use original EventBridge rule.

You can hook the lambda functions to your API Gateway to manage your schedules. The schedules will store in the DynamoDB table, you can tracking the schedules status, execution results, etc...

![Architecture](docs/schedule-function-architecture.png)

---

## Installation

```
npm install @softchef/cdk-schedule-function

or

yarn add @softchef/cdk-schedule-function
```

## Usage

```
const scheduleFunction = new ScheduleFunction(stack, 'ScheduleFunction', {});

scheduleFunction.addTargetFunction('CreateJob', targetFunction);

```

The Target Function is actual to execute function for business logic. The 'CreateJob' is targetType to identify this function when schedule running.

You can add many targetFunction to process different logic.


## Hook

```
const restApi = new apigateway.RestApi(stack, 'RestApi');

const rootResource = restApi.root.addResource('schedules');

rootResource.addMethod('POST', apigateway.LambdaIntegration(scheduleFunction.createScheduleFunction));  // Create schdules
rootResource.addMethod('GET', apigateway.LambdaIntegration(scheduleFunction.listSchedulesFunction));  // List schdules

const scheduleResource = rootResource.addResource('{scheduleId}');

scheduleResource.addMethod('GET', apigateway.LambdaIntegration(scheduleFunction.fetchScheduleFunction));  // Fetch schdule
scheduleResource.addMethod('PUT', apigateway.LambdaIntegration(scheduleFunction.updateSchedulesFunction));  // Update schdule
scheduleResource.addMethod('PUT', apigateway.LambdaIntegration(scheduleFunction.deleteSchedulesFunction));  // Delete schdule

more...
```

## Example

[Demo stack](./src/demo)

## Roadmap

- DispatchTarget performance up(StepFunction or SQS)
- Export more internal resource
- DynamoDB indexs/capacity best optimization

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