Package Exports
- @serverless-toolkit/cli/.build/cli
- @serverless-toolkit/cli/.build/cli/index.js
- @serverless-toolkit/cli/.build/cli/init
- @serverless-toolkit/cli/.build/cli/init.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@serverless-toolkit/cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
PoC - Serverless Toolkit CLI
Setup
- Install dependencies
yarn
- Create Saga with initial state
yarn:create
- Restore state -> apply command -> save "new" state
yarn:update
yarn:update-increment
yarn:update-decrement
- Deploy using Lambda Function-URL
yarn deploy
Todos
- upgrade to AWS-CDK v2.x
- docs hosted zone / optional domain name
- add cdk app script to app root (stk init)
Concepts
Instance Management
- list sagas by type using the CLI
- create and destory saga by id using the CLI
- correlation/instance ID can be client generated, using UUID by default
SDK
import { bindings, alarm, credentials, expire, store, worker } from 'gusto-sdk'
Bindings
- defines the local handler for external events e.g.
bindings.ses['contact@example.com'].on('inbound').bind(this.onInbound)
examples
export default class Counter {
constructur() {
Counter.addBinding(bindings.ses.onInbound('contact@example.com').bind(this.onEmail))
}
}
export default function counter() {
doSomething.addBinding(bindings.ses.onInbound('contact@example.com'))
}
Communication
- using a HTTP based API
- external events as trigger (e.g. SES, Event-Bridge, Shopify, etc.) via Bindings from our SDK
Worker execution
- default execution timeout is 15 Minutes
- concurrent execution is 1000
- maximum memory size is 128MB
- request response invocation
- e.g. chaining via
const response = await worker.invoke('other')
Saga execution
- default execution timeout is 1 Minute
- concurrent execution is 1 per Saga type
- maximum memory size is 128MB
- async invocation using an event queue (unordered, at-least-once)
Saga persistent state
- every
public
property is persistent - the maximum serialized size of a persistent property is 400kb
KV Store
- available via
store
list
,get
,set
andremove
operations to query and modify states- handle changes using
onChange
handler attached to DynamoDB change stream
Commands
- the command handler is a function of the Saga and has the same name as the command
- command handler invocation via
command
property - command arguments via
commandArgs
property
Alarms
- invocation at a specific time
- handle alarm using
onAlarm
alarm
-set
,clear
Security
- 3rd party code execution is dynamically loaded from S3 and sandboxed in VM2
- credential KV store is available via
credentials
- credential KV store management via CLI
Saga expiry
- default expiry is 1 year
- reschedule possible
- handle expiry using
onExpire
expire
-at
Page objects
- Svelte and Markdown based Server Side Rendering