├── .DS_Store ├── .gitignore ├── LICENCE ├── README.md ├── functions ├── stock-buyer │ ├── app.js │ ├── package-lock.json │ └── package.json ├── stock-checker │ ├── app.js │ └── package.json └── stock-seller │ ├── app.js │ ├── package-lock.json │ └── package.json ├── repoResources └── stateMachine.png ├── statemachine └── stock_trader.asl.json └── template.yaml /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/example-step-functions-integration-api-gateway/68f515d37d0392eeddf148e78df814b52ff66490/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .npmignore 3 | samconfig.toml 4 | .env 5 | .vscode 6 | functions/.DS_Store 7 | .DS_Store -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | MIT No Attribution Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so. 9 | 10 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 11 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 12 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS 13 | OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 14 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 15 | OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Example Step Functions API Gateway integration 2 | 3 | The new Step Functions integration with API Gateway provides an additional resource type, ` arn:aws:states:::apigateway:invoke ` and can be used with both Standard and Express workflows. It allows customers to call API Gateway REST APIs and API Gateway. 4 | 5 | See this [AWS compute blog](https://aws.amazon.com/blogs/compute/introducing-amazon-api-gateway-service-integration-for-aws-step-functions/) for more information on the Step Functions service integration with API Gateway. 6 | 7 | ![API Gateway Step Fcuntions service integration](/repoResources/stateMachine.png) 8 | 9 | This project contains source code and supporting files for a serverless application that you can deploy with the SAM CLI. It includes the following files and folders: 10 | 11 | - functions - Code for the application's Lambda functions to check the value of buy or sell shares of a stock. 12 | - statemachines - Definition for the state machine that orchestrates the stock trading workflow. 13 | - template.yaml - A template that defines the application's AWS resources. 14 | 15 | This application creates a mock stock trading workflow which runs on a pre-defined schedule (note that the schedule is disabled by default to avoid incurring charges). It demonstrates the power of Step Functions to orchestrate Lambda functions and other AWS resources to form complex and robust workflows, coupled with event-driven development using Amazon EventBridge. 16 | 17 | When the workflow is run, a Lambda function is invoked via a GET request from API Gateway to the /check resource. This returns a random stock value between 1 and 100. This value is evaluated in the Buy or Sell choice step, depending on if it is less or more than 50. The Sell and Buy states use the API Gateway integration to invoke a Lambda function, with a POST method. A stock_value is provided in the POST request body. A transaction_result is returned in the Response Body and provided to the next state. The final state writes a log of the transition to a DynamoDB table. 18 | 19 | ## Deploy the sample application 20 | 21 | The Serverless Application Model Command Line Interface (SAM CLI) is an extension of the AWS CLI that adds functionality for building and testing Lambda applications. It uses Docker to run your functions in an Amazon Linux environment that matches Lambda. 22 | 23 | To use the SAM CLI, you need the following tools: 24 | 25 | * SAM CLI - [Install the SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) 26 | * Node.js - [Install Node.js 12](https://nodejs.org/en/), including the NPM package management tool. 27 | * Docker - [Install Docker community edition](https://hub.docker.com/search/?type=edition&offering=community) 28 | 29 | To build and deploy your application for the first time, run the following in your shell: 30 | 31 | 1. Clone the GitHub repository: 32 | ```bash 33 | $ git clone https://github.com/aws-samples/example-step-functions-integration-api-gateway.git 34 | $ cd example-step-functions-integration-api-gateway 35 | ``` 36 | 37 | 2. Deploy the application resources: 38 | 39 | ```bash 40 | sam build 41 | sam deploy --guided 42 | ``` 43 | 44 | The first command will build the source of your application. The second command will package and deploy your application to AWS, with a series of prompts: 45 | 46 | * **Stack Name**: The name of the stack to deploy to CloudFormation. This should be unique to your account and region, and a good starting point would be something matching your project name. 47 | * **AWS Region**: The AWS region you want to deploy your app to. 48 | * **Confirm changes before deploy**: If set to yes, any change sets will be shown to you before execution for manual review. If set to no, the AWS SAM CLI will automatically deploy application changes. 49 | * **Allow SAM CLI IAM role creation**: Many AWS SAM templates, including this example, create AWS IAM roles required for the AWS Lambda function(s) included to access AWS services. By default, these are scoped down to minimum required permissions. To deploy an AWS CloudFormation stack which creates or modified IAM roles, the `CAPABILITY_IAM` value for `capabilities` must be provided. If permission isn't provided through this prompt, to deploy this example you must explicitly pass `--capabilities CAPABILITY_IAM` to the `sam deploy` command. 50 | * **Save arguments to samconfig.toml**: If set to yes, your choices will be saved to a configuration file inside the project, so that in the future you can just re-run `sam deploy` without parameters to deploy changes to your application. 51 | 52 | You can find your State Machine ARN in the output values displayed after deployment. 53 | 54 | ## Manually trigger the workflow from a terminal window: 55 | 56 | ``` bash 57 | aws stepfunctions start-execution \ 58 | --state-machine-arn 59 | ``` 60 | 61 | 62 | 63 | 64 | ## Cleanup 65 | ``` 66 | 67 | ## Cleanup 68 | 69 | To delete the sample application that you created, use the AWS CLI. Assuming you used your project name for the stack name, you can run the following: 70 | 71 | ```bash 72 | aws cloudformation delete-stack --stack-name sfn-apigw-example2 73 | ``` 74 | 75 | ## Resources 76 | 77 | See this [AWS compute blog](https://aws.amazon.com/blogs/compute/introducing-amazon-api-gateway-service-integration-for-aws-step-functions/) for more information on the Step Functions service integration with API Gateway. 78 | 79 | See the [AWS SAM developer guide](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html) for an introduction to SAM specification, the SAM CLI, and serverless application concepts. 80 | 81 | Next, you can use AWS Serverless Application Repository to deploy ready to use Apps that go beyond hello world samples and learn how authors developed their applications: [AWS Serverless Application Repository main page](https://aws.amazon.com/serverless/serverlessrepo/) 82 | -------------------------------------------------------------------------------- /functions/stock-buyer/app.js: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-FileCopyrightText: 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | SPDX-License-Identifier: MIT-0 4 | */ 5 | 6 | const crypto = require("crypto"); 7 | 8 | function getRandomInt(max) { 9 | return Math.floor(Math.random() * Math.floor(max)) + 1; 10 | } 11 | 12 | /** 13 | * Sample Lambda function which mocks the operation of buying a random number of shares for a stock. 14 | * For demonstration purposes, this Lambda function does not actually perform any actual transactions. It simply returns a mocked result. 15 | * 16 | * @param {Object} event - Input event to the Lambda function 17 | * @param {Object} context - Lambda Context runtime methods and attributes 18 | * 19 | * @returns {Object} object - Object containing details of the stock buying transaction 20 | * 21 | */ 22 | exports.lambdaHandler = async (event, context) => { 23 | // Get the price of the stock provided as input 24 | 25 | const body = JSON.parse(event.body) 26 | const stock_price = body.stock_price 27 | 28 | var date = new Date(); 29 | // Mocked result of a stock buying transaction 30 | const transaction_result = { 31 | 'id': crypto.randomBytes(16).toString("hex"), // Unique ID for the transaction 32 | 'price': stock_price.toString(), // Price of each share 33 | 'type': "buy", // Type of transaction(buy/ sell) 34 | 'qty': getRandomInt(10).toString(), // Number of shares bought / sold(We are mocking this as a random integer between 1 and 10) 35 | 'timestamp': date.toISOString(), // Timestamp of the when the transaction was completed 36 | } 37 | 38 | return { 39 | statusCode: 200, 40 | body:JSON.stringify(transaction_result), 41 | } 42 | 43 | }; 44 | -------------------------------------------------------------------------------- /functions/stock-buyer/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "stock_checker", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "ansi-colors": { 8 | "version": "4.1.1", 9 | "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", 10 | "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", 11 | "dev": true 12 | }, 13 | "ansi-regex": { 14 | "version": "5.0.1", 15 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", 16 | "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", 17 | "dev": true 18 | }, 19 | "ansi-styles": { 20 | "version": "4.3.0", 21 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", 22 | "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", 23 | "dev": true, 24 | "requires": { 25 | "color-convert": "^2.0.1" 26 | } 27 | }, 28 | "anymatch": { 29 | "version": "3.1.3", 30 | "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", 31 | "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", 32 | "dev": true, 33 | "requires": { 34 | "normalize-path": "^3.0.0", 35 | "picomatch": "^2.0.4" 36 | } 37 | }, 38 | "argparse": { 39 | "version": "2.0.1", 40 | "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", 41 | "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", 42 | "dev": true 43 | }, 44 | "assertion-error": { 45 | "version": "1.1.0", 46 | "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", 47 | "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", 48 | "dev": true 49 | }, 50 | "balanced-match": { 51 | "version": "1.0.2", 52 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", 53 | "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", 54 | "dev": true 55 | }, 56 | "binary-extensions": { 57 | "version": "2.2.0", 58 | "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", 59 | "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", 60 | "dev": true 61 | }, 62 | "brace-expansion": { 63 | "version": "1.1.11", 64 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 65 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", 66 | "dev": true, 67 | "requires": { 68 | "balanced-match": "^1.0.0", 69 | "concat-map": "0.0.1" 70 | } 71 | }, 72 | "braces": { 73 | "version": "3.0.3", 74 | "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", 75 | "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", 76 | "dev": true, 77 | "requires": { 78 | "fill-range": "^7.1.1" 79 | }, 80 | "dependencies": { 81 | "fill-range": { 82 | "version": "7.1.1", 83 | "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", 84 | "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", 85 | "dev": true, 86 | "requires": { 87 | "to-regex-range": "^5.0.1" 88 | } 89 | } 90 | } 91 | }, 92 | "browser-stdout": { 93 | "version": "1.3.1", 94 | "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", 95 | "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", 96 | "dev": true 97 | }, 98 | "camelcase": { 99 | "version": "6.3.0", 100 | "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", 101 | "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", 102 | "dev": true 103 | }, 104 | "chai": { 105 | "version": "4.2.0", 106 | "resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz", 107 | "integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==", 108 | "dev": true, 109 | "requires": { 110 | "assertion-error": "^1.1.0", 111 | "check-error": "^1.0.2", 112 | "deep-eql": "^3.0.1", 113 | "get-func-name": "^2.0.0", 114 | "pathval": "^1.1.0", 115 | "type-detect": "^4.0.5" 116 | } 117 | }, 118 | "chalk": { 119 | "version": "4.1.2", 120 | "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", 121 | "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", 122 | "dev": true, 123 | "requires": { 124 | "ansi-styles": "^4.1.0", 125 | "supports-color": "^7.1.0" 126 | }, 127 | "dependencies": { 128 | "supports-color": { 129 | "version": "7.2.0", 130 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", 131 | "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", 132 | "dev": true, 133 | "requires": { 134 | "has-flag": "^4.0.0" 135 | } 136 | } 137 | } 138 | }, 139 | "check-error": { 140 | "version": "1.0.2", 141 | "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", 142 | "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", 143 | "dev": true 144 | }, 145 | "chokidar": { 146 | "version": "3.5.3", 147 | "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", 148 | "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", 149 | "dev": true, 150 | "requires": { 151 | "anymatch": "~3.1.2", 152 | "braces": "~3.0.2", 153 | "fsevents": "~2.3.2", 154 | "glob-parent": "~5.1.2", 155 | "is-binary-path": "~2.1.0", 156 | "is-glob": "~4.0.1", 157 | "normalize-path": "~3.0.0", 158 | "readdirp": "~3.6.0" 159 | } 160 | }, 161 | "cliui": { 162 | "version": "7.0.4", 163 | "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", 164 | "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", 165 | "dev": true, 166 | "requires": { 167 | "string-width": "^4.2.0", 168 | "strip-ansi": "^6.0.0", 169 | "wrap-ansi": "^7.0.0" 170 | } 171 | }, 172 | "color-convert": { 173 | "version": "2.0.1", 174 | "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", 175 | "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", 176 | "dev": true, 177 | "requires": { 178 | "color-name": "~1.1.4" 179 | } 180 | }, 181 | "color-name": { 182 | "version": "1.1.4", 183 | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", 184 | "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", 185 | "dev": true 186 | }, 187 | "concat-map": { 188 | "version": "0.0.1", 189 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 190 | "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", 191 | "dev": true 192 | }, 193 | "debug": { 194 | "version": "4.3.4", 195 | "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", 196 | "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", 197 | "dev": true, 198 | "requires": { 199 | "ms": "2.1.2" 200 | }, 201 | "dependencies": { 202 | "ms": { 203 | "version": "2.1.2", 204 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", 205 | "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", 206 | "dev": true 207 | } 208 | } 209 | }, 210 | "decamelize": { 211 | "version": "4.0.0", 212 | "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", 213 | "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", 214 | "dev": true 215 | }, 216 | "deep-eql": { 217 | "version": "3.0.1", 218 | "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", 219 | "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", 220 | "dev": true, 221 | "requires": { 222 | "type-detect": "^4.0.0" 223 | } 224 | }, 225 | "diff": { 226 | "version": "5.0.0", 227 | "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", 228 | "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", 229 | "dev": true 230 | }, 231 | "emoji-regex": { 232 | "version": "8.0.0", 233 | "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", 234 | "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", 235 | "dev": true 236 | }, 237 | "escalade": { 238 | "version": "3.1.1", 239 | "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", 240 | "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", 241 | "dev": true 242 | }, 243 | "escape-string-regexp": { 244 | "version": "4.0.0", 245 | "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", 246 | "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", 247 | "dev": true 248 | }, 249 | "find-up": { 250 | "version": "5.0.0", 251 | "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", 252 | "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", 253 | "dev": true, 254 | "requires": { 255 | "locate-path": "^6.0.0", 256 | "path-exists": "^4.0.0" 257 | } 258 | }, 259 | "flat": { 260 | "version": "5.0.2", 261 | "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", 262 | "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", 263 | "dev": true 264 | }, 265 | "fs.realpath": { 266 | "version": "1.0.0", 267 | "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", 268 | "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", 269 | "dev": true 270 | }, 271 | "fsevents": { 272 | "version": "2.3.2", 273 | "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", 274 | "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", 275 | "dev": true, 276 | "optional": true 277 | }, 278 | "get-caller-file": { 279 | "version": "2.0.5", 280 | "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", 281 | "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", 282 | "dev": true 283 | }, 284 | "get-func-name": { 285 | "version": "2.0.0", 286 | "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", 287 | "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", 288 | "dev": true 289 | }, 290 | "glob": { 291 | "version": "7.2.0", 292 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", 293 | "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", 294 | "dev": true, 295 | "requires": { 296 | "fs.realpath": "^1.0.0", 297 | "inflight": "^1.0.4", 298 | "inherits": "2", 299 | "minimatch": "^3.0.4", 300 | "once": "^1.3.0", 301 | "path-is-absolute": "^1.0.0" 302 | }, 303 | "dependencies": { 304 | "minimatch": { 305 | "version": "3.1.2", 306 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", 307 | "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", 308 | "dev": true, 309 | "requires": { 310 | "brace-expansion": "^1.1.7" 311 | } 312 | } 313 | } 314 | }, 315 | "glob-parent": { 316 | "version": "5.1.2", 317 | "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", 318 | "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", 319 | "dev": true, 320 | "requires": { 321 | "is-glob": "^4.0.1" 322 | } 323 | }, 324 | "has-flag": { 325 | "version": "4.0.0", 326 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", 327 | "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", 328 | "dev": true 329 | }, 330 | "he": { 331 | "version": "1.2.0", 332 | "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", 333 | "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", 334 | "dev": true 335 | }, 336 | "inflight": { 337 | "version": "1.0.6", 338 | "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", 339 | "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", 340 | "dev": true, 341 | "requires": { 342 | "once": "^1.3.0", 343 | "wrappy": "1" 344 | } 345 | }, 346 | "inherits": { 347 | "version": "2.0.4", 348 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 349 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", 350 | "dev": true 351 | }, 352 | "is-binary-path": { 353 | "version": "2.1.0", 354 | "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", 355 | "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", 356 | "dev": true, 357 | "requires": { 358 | "binary-extensions": "^2.0.0" 359 | } 360 | }, 361 | "is-extglob": { 362 | "version": "2.1.1", 363 | "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", 364 | "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", 365 | "dev": true 366 | }, 367 | "is-fullwidth-code-point": { 368 | "version": "3.0.0", 369 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", 370 | "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", 371 | "dev": true 372 | }, 373 | "is-glob": { 374 | "version": "4.0.3", 375 | "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", 376 | "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", 377 | "dev": true, 378 | "requires": { 379 | "is-extglob": "^2.1.1" 380 | } 381 | }, 382 | "is-number": { 383 | "version": "7.0.0", 384 | "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", 385 | "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", 386 | "dev": true 387 | }, 388 | "is-plain-obj": { 389 | "version": "2.1.0", 390 | "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", 391 | "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", 392 | "dev": true 393 | }, 394 | "is-unicode-supported": { 395 | "version": "0.1.0", 396 | "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", 397 | "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", 398 | "dev": true 399 | }, 400 | "js-yaml": { 401 | "version": "4.1.0", 402 | "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", 403 | "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", 404 | "dev": true, 405 | "requires": { 406 | "argparse": "^2.0.1" 407 | } 408 | }, 409 | "locate-path": { 410 | "version": "6.0.0", 411 | "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", 412 | "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", 413 | "dev": true, 414 | "requires": { 415 | "p-locate": "^5.0.0" 416 | } 417 | }, 418 | "log-symbols": { 419 | "version": "4.1.0", 420 | "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", 421 | "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", 422 | "dev": true, 423 | "requires": { 424 | "chalk": "^4.1.0", 425 | "is-unicode-supported": "^0.1.0" 426 | } 427 | }, 428 | "minimatch": { 429 | "version": "5.0.1", 430 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", 431 | "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", 432 | "dev": true, 433 | "requires": { 434 | "brace-expansion": "^2.0.1" 435 | }, 436 | "dependencies": { 437 | "brace-expansion": { 438 | "version": "2.0.1", 439 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", 440 | "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", 441 | "dev": true, 442 | "requires": { 443 | "balanced-match": "^1.0.0" 444 | } 445 | } 446 | } 447 | }, 448 | "mocha": { 449 | "version": "10.2.0", 450 | "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz", 451 | "integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==", 452 | "dev": true, 453 | "requires": { 454 | "ansi-colors": "4.1.1", 455 | "browser-stdout": "1.3.1", 456 | "chokidar": "3.5.3", 457 | "debug": "4.3.4", 458 | "diff": "5.0.0", 459 | "escape-string-regexp": "4.0.0", 460 | "find-up": "5.0.0", 461 | "glob": "7.2.0", 462 | "he": "1.2.0", 463 | "js-yaml": "4.1.0", 464 | "log-symbols": "4.1.0", 465 | "minimatch": "5.0.1", 466 | "ms": "2.1.3", 467 | "nanoid": "3.3.3", 468 | "serialize-javascript": "6.0.0", 469 | "strip-json-comments": "3.1.1", 470 | "supports-color": "8.1.1", 471 | "workerpool": "6.2.1", 472 | "yargs": "16.2.0", 473 | "yargs-parser": "20.2.4", 474 | "yargs-unparser": "2.0.0" 475 | } 476 | }, 477 | "ms": { 478 | "version": "2.1.3", 479 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", 480 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", 481 | "dev": true 482 | }, 483 | "nanoid": { 484 | "version": "3.3.3", 485 | "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", 486 | "integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==", 487 | "dev": true 488 | }, 489 | "normalize-path": { 490 | "version": "3.0.0", 491 | "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", 492 | "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", 493 | "dev": true 494 | }, 495 | "once": { 496 | "version": "1.4.0", 497 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 498 | "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", 499 | "dev": true, 500 | "requires": { 501 | "wrappy": "1" 502 | } 503 | }, 504 | "p-limit": { 505 | "version": "3.1.0", 506 | "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", 507 | "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", 508 | "dev": true, 509 | "requires": { 510 | "yocto-queue": "^0.1.0" 511 | } 512 | }, 513 | "p-locate": { 514 | "version": "5.0.0", 515 | "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", 516 | "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", 517 | "dev": true, 518 | "requires": { 519 | "p-limit": "^3.0.2" 520 | } 521 | }, 522 | "path-exists": { 523 | "version": "4.0.0", 524 | "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", 525 | "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", 526 | "dev": true 527 | }, 528 | "path-is-absolute": { 529 | "version": "1.0.1", 530 | "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", 531 | "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", 532 | "dev": true 533 | }, 534 | "pathval": { 535 | "version": "1.1.1", 536 | "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", 537 | "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", 538 | "dev": true 539 | }, 540 | "picomatch": { 541 | "version": "2.3.1", 542 | "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", 543 | "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", 544 | "dev": true 545 | }, 546 | "randombytes": { 547 | "version": "2.1.0", 548 | "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", 549 | "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", 550 | "dev": true, 551 | "requires": { 552 | "safe-buffer": "^5.1.0" 553 | } 554 | }, 555 | "readdirp": { 556 | "version": "3.6.0", 557 | "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", 558 | "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", 559 | "dev": true, 560 | "requires": { 561 | "picomatch": "^2.2.1" 562 | } 563 | }, 564 | "require-directory": { 565 | "version": "2.1.1", 566 | "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", 567 | "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", 568 | "dev": true 569 | }, 570 | "safe-buffer": { 571 | "version": "5.2.1", 572 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", 573 | "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", 574 | "dev": true 575 | }, 576 | "serialize-javascript": { 577 | "version": "6.0.0", 578 | "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", 579 | "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", 580 | "dev": true, 581 | "requires": { 582 | "randombytes": "^2.1.0" 583 | } 584 | }, 585 | "string-width": { 586 | "version": "4.2.3", 587 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", 588 | "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", 589 | "dev": true, 590 | "requires": { 591 | "emoji-regex": "^8.0.0", 592 | "is-fullwidth-code-point": "^3.0.0", 593 | "strip-ansi": "^6.0.1" 594 | } 595 | }, 596 | "strip-ansi": { 597 | "version": "6.0.1", 598 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", 599 | "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", 600 | "dev": true, 601 | "requires": { 602 | "ansi-regex": "^5.0.1" 603 | } 604 | }, 605 | "strip-json-comments": { 606 | "version": "3.1.1", 607 | "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", 608 | "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", 609 | "dev": true 610 | }, 611 | "supports-color": { 612 | "version": "8.1.1", 613 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", 614 | "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", 615 | "dev": true, 616 | "requires": { 617 | "has-flag": "^4.0.0" 618 | } 619 | }, 620 | "to-regex-range": { 621 | "version": "5.0.1", 622 | "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", 623 | "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", 624 | "dev": true, 625 | "requires": { 626 | "is-number": "^7.0.0" 627 | } 628 | }, 629 | "type-detect": { 630 | "version": "4.0.8", 631 | "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", 632 | "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", 633 | "dev": true 634 | }, 635 | "workerpool": { 636 | "version": "6.2.1", 637 | "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", 638 | "integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==", 639 | "dev": true 640 | }, 641 | "wrap-ansi": { 642 | "version": "7.0.0", 643 | "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", 644 | "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", 645 | "dev": true, 646 | "requires": { 647 | "ansi-styles": "^4.0.0", 648 | "string-width": "^4.1.0", 649 | "strip-ansi": "^6.0.0" 650 | } 651 | }, 652 | "wrappy": { 653 | "version": "1.0.2", 654 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 655 | "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", 656 | "dev": true 657 | }, 658 | "y18n": { 659 | "version": "5.0.8", 660 | "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", 661 | "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", 662 | "dev": true 663 | }, 664 | "yargs": { 665 | "version": "16.2.0", 666 | "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", 667 | "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", 668 | "dev": true, 669 | "requires": { 670 | "cliui": "^7.0.2", 671 | "escalade": "^3.1.1", 672 | "get-caller-file": "^2.0.5", 673 | "require-directory": "^2.1.1", 674 | "string-width": "^4.2.0", 675 | "y18n": "^5.0.5", 676 | "yargs-parser": "^20.2.2" 677 | } 678 | }, 679 | "yargs-parser": { 680 | "version": "20.2.4", 681 | "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", 682 | "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", 683 | "dev": true 684 | }, 685 | "yargs-unparser": { 686 | "version": "2.0.0", 687 | "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", 688 | "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", 689 | "dev": true, 690 | "requires": { 691 | "camelcase": "^6.0.0", 692 | "decamelize": "^4.0.0", 693 | "flat": "^5.0.2", 694 | "is-plain-obj": "^2.1.0" 695 | } 696 | }, 697 | "yocto-queue": { 698 | "version": "0.1.0", 699 | "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", 700 | "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", 701 | "dev": true 702 | } 703 | } 704 | } 705 | -------------------------------------------------------------------------------- /functions/stock-buyer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "stock_checker", 3 | "version": "1.0.0", 4 | "description": "Mock stock checker for NodeJS", 5 | "main": "app.js", 6 | "repository": "TODO", 7 | "author": "SAM CLI", 8 | "license": "MIT", 9 | "dependencies": {}, 10 | "scripts": { 11 | "test": "mocha tests/unit/" 12 | }, 13 | "devDependencies": { 14 | "chai": "^4.2.0", 15 | "mocha": "^10.2.0" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /functions/stock-checker/app.js: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-FileCopyrightText: 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | SPDX-License-Identifier: MIT-0 4 | */ 5 | 6 | function getRandomInt(max) { 7 | return Math.floor(Math.random() * Math.floor(max)); 8 | } 9 | 10 | /** 11 | * Sample Lambda function which mocks the operation of checking the current price of a stock. 12 | * For demonstration purposes this Lambda function simply returns a random integer between 0 and 100 as the stock price. 13 | * 14 | * @param {Object} event - Input event to the Lambda function 15 | * @param {Object} context - Lambda Context runtime methods and attributes 16 | * 17 | * @returns {Object} object - Object containing the current price of the stock 18 | * 19 | */ 20 | exports.lambdaHandler = async (event, context) => { 21 | // Check current price of the stock 22 | stock_price = getRandomInt(100) // Current stock price is mocked as a random integer between 0 and 100 23 | return { 24 | statusCode: 200, 25 | body:JSON.stringify({"stock_price": stock_price }), 26 | } 27 | }; 28 | -------------------------------------------------------------------------------- /functions/stock-checker/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "stock_checker", 3 | "version": "1.0.0", 4 | "description": "Mock stock checker for NodeJS", 5 | "main": "app.js", 6 | "repository": "TODO", 7 | "author": "SAM CLI", 8 | "license": "MIT", 9 | "dependencies": {}, 10 | "scripts": { 11 | "test": "mocha tests/unit/" 12 | }, 13 | "devDependencies": { 14 | "chai": "^4.2.0", 15 | "mocha": "^6.1.4" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /functions/stock-seller/app.js: -------------------------------------------------------------------------------- 1 | /* 2 | SPDX-FileCopyrightText: 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | SPDX-License-Identifier: MIT-0 4 | */ 5 | 6 | const crypto = require("crypto"); 7 | 8 | function getRandomInt(max) { 9 | return Math.floor(Math.random() * Math.floor(max)) + 1; 10 | } 11 | 12 | /** 13 | * Sample Lambda function which mocks the operation of selling a random number of shares for a stock. 14 | * For demonstration purposes, this Lambda function does not actually perform any actual transactions. It simply returns a mocked result. 15 | * 16 | * @param {Object} event - Input event to the Lambda function 17 | * @param {Object} context - Lambda Context runtime methods and attributes 18 | * 19 | * @returns {Object} object - Object containing details of the stock selling transaction 20 | * 21 | */ 22 | exports.lambdaHandler = async (event, context) => { 23 | // Get the price of the stock provided as input 24 | const body = JSON.parse(event.body) 25 | const stock_price = body.stock_price 26 | 27 | var date = new Date(); 28 | // Mocked result of a stock selling transaction 29 | let transaction_result = { 30 | 'id': crypto.randomBytes(16).toString("hex"), // Unique ID for the transaction 31 | 'price': stock_price.toString(), // Price of each share 32 | 'type': "sell", // Type of transaction (buy/ sell) 33 | 'qty': getRandomInt(10).toString(), // Number of shares bought / sold (We are mocking this as a random integer between 1 and 10) 34 | 'timestamp': date.toISOString(), // Timestamp for when the transaction was completed 35 | } 36 | return { 37 | statusCode: 200, 38 | body:JSON.stringify(transaction_result ), 39 | } 40 | }; 41 | -------------------------------------------------------------------------------- /functions/stock-seller/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "stock_checker", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "ansi-colors": { 8 | "version": "4.1.1", 9 | "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", 10 | "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", 11 | "dev": true 12 | }, 13 | "ansi-regex": { 14 | "version": "5.0.1", 15 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", 16 | "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", 17 | "dev": true 18 | }, 19 | "ansi-styles": { 20 | "version": "4.3.0", 21 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", 22 | "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", 23 | "dev": true, 24 | "requires": { 25 | "color-convert": "^2.0.1" 26 | } 27 | }, 28 | "anymatch": { 29 | "version": "3.1.3", 30 | "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", 31 | "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", 32 | "dev": true, 33 | "requires": { 34 | "normalize-path": "^3.0.0", 35 | "picomatch": "^2.0.4" 36 | } 37 | }, 38 | "argparse": { 39 | "version": "2.0.1", 40 | "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", 41 | "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", 42 | "dev": true 43 | }, 44 | "assertion-error": { 45 | "version": "1.1.0", 46 | "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", 47 | "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", 48 | "dev": true 49 | }, 50 | "balanced-match": { 51 | "version": "1.0.2", 52 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", 53 | "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", 54 | "dev": true 55 | }, 56 | "binary-extensions": { 57 | "version": "2.2.0", 58 | "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", 59 | "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", 60 | "dev": true 61 | }, 62 | "brace-expansion": { 63 | "version": "1.1.11", 64 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 65 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", 66 | "dev": true, 67 | "requires": { 68 | "balanced-match": "^1.0.0", 69 | "concat-map": "0.0.1" 70 | } 71 | }, 72 | "braces": { 73 | "version": "3.0.3", 74 | "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", 75 | "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", 76 | "dev": true, 77 | "requires": { 78 | "fill-range": "^7.1.1" 79 | }, 80 | "dependencies": { 81 | "fill-range": { 82 | "version": "7.1.1", 83 | "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", 84 | "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", 85 | "dev": true, 86 | "requires": { 87 | "to-regex-range": "^5.0.1" 88 | } 89 | } 90 | } 91 | }, 92 | "browser-stdout": { 93 | "version": "1.3.1", 94 | "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", 95 | "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", 96 | "dev": true 97 | }, 98 | "camelcase": { 99 | "version": "6.3.0", 100 | "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", 101 | "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", 102 | "dev": true 103 | }, 104 | "chai": { 105 | "version": "4.2.0", 106 | "resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz", 107 | "integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==", 108 | "dev": true, 109 | "requires": { 110 | "assertion-error": "^1.1.0", 111 | "check-error": "^1.0.2", 112 | "deep-eql": "^3.0.1", 113 | "get-func-name": "^2.0.0", 114 | "pathval": "^1.1.0", 115 | "type-detect": "^4.0.5" 116 | } 117 | }, 118 | "chalk": { 119 | "version": "4.1.2", 120 | "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", 121 | "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", 122 | "dev": true, 123 | "requires": { 124 | "ansi-styles": "^4.1.0", 125 | "supports-color": "^7.1.0" 126 | }, 127 | "dependencies": { 128 | "supports-color": { 129 | "version": "7.2.0", 130 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", 131 | "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", 132 | "dev": true, 133 | "requires": { 134 | "has-flag": "^4.0.0" 135 | } 136 | } 137 | } 138 | }, 139 | "check-error": { 140 | "version": "1.0.2", 141 | "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", 142 | "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", 143 | "dev": true 144 | }, 145 | "chokidar": { 146 | "version": "3.5.3", 147 | "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", 148 | "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", 149 | "dev": true, 150 | "requires": { 151 | "anymatch": "~3.1.2", 152 | "braces": "~3.0.2", 153 | "fsevents": "~2.3.2", 154 | "glob-parent": "~5.1.2", 155 | "is-binary-path": "~2.1.0", 156 | "is-glob": "~4.0.1", 157 | "normalize-path": "~3.0.0", 158 | "readdirp": "~3.6.0" 159 | } 160 | }, 161 | "cliui": { 162 | "version": "7.0.4", 163 | "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", 164 | "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", 165 | "dev": true, 166 | "requires": { 167 | "string-width": "^4.2.0", 168 | "strip-ansi": "^6.0.0", 169 | "wrap-ansi": "^7.0.0" 170 | } 171 | }, 172 | "color-convert": { 173 | "version": "2.0.1", 174 | "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", 175 | "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", 176 | "dev": true, 177 | "requires": { 178 | "color-name": "~1.1.4" 179 | } 180 | }, 181 | "color-name": { 182 | "version": "1.1.4", 183 | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", 184 | "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", 185 | "dev": true 186 | }, 187 | "concat-map": { 188 | "version": "0.0.1", 189 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 190 | "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", 191 | "dev": true 192 | }, 193 | "debug": { 194 | "version": "4.3.4", 195 | "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", 196 | "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", 197 | "dev": true, 198 | "requires": { 199 | "ms": "2.1.2" 200 | }, 201 | "dependencies": { 202 | "ms": { 203 | "version": "2.1.2", 204 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", 205 | "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", 206 | "dev": true 207 | } 208 | } 209 | }, 210 | "decamelize": { 211 | "version": "4.0.0", 212 | "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", 213 | "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", 214 | "dev": true 215 | }, 216 | "deep-eql": { 217 | "version": "3.0.1", 218 | "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", 219 | "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", 220 | "dev": true, 221 | "requires": { 222 | "type-detect": "^4.0.0" 223 | } 224 | }, 225 | "diff": { 226 | "version": "5.0.0", 227 | "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", 228 | "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", 229 | "dev": true 230 | }, 231 | "emoji-regex": { 232 | "version": "8.0.0", 233 | "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", 234 | "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", 235 | "dev": true 236 | }, 237 | "escalade": { 238 | "version": "3.1.1", 239 | "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", 240 | "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", 241 | "dev": true 242 | }, 243 | "escape-string-regexp": { 244 | "version": "4.0.0", 245 | "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", 246 | "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", 247 | "dev": true 248 | }, 249 | "find-up": { 250 | "version": "5.0.0", 251 | "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", 252 | "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", 253 | "dev": true, 254 | "requires": { 255 | "locate-path": "^6.0.0", 256 | "path-exists": "^4.0.0" 257 | } 258 | }, 259 | "flat": { 260 | "version": "5.0.2", 261 | "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", 262 | "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", 263 | "dev": true 264 | }, 265 | "fs.realpath": { 266 | "version": "1.0.0", 267 | "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", 268 | "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", 269 | "dev": true 270 | }, 271 | "fsevents": { 272 | "version": "2.3.2", 273 | "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", 274 | "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", 275 | "dev": true, 276 | "optional": true 277 | }, 278 | "get-caller-file": { 279 | "version": "2.0.5", 280 | "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", 281 | "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", 282 | "dev": true 283 | }, 284 | "get-func-name": { 285 | "version": "2.0.0", 286 | "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", 287 | "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", 288 | "dev": true 289 | }, 290 | "glob": { 291 | "version": "7.2.0", 292 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", 293 | "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", 294 | "dev": true, 295 | "requires": { 296 | "fs.realpath": "^1.0.0", 297 | "inflight": "^1.0.4", 298 | "inherits": "2", 299 | "minimatch": "^3.0.4", 300 | "once": "^1.3.0", 301 | "path-is-absolute": "^1.0.0" 302 | }, 303 | "dependencies": { 304 | "minimatch": { 305 | "version": "3.1.2", 306 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", 307 | "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", 308 | "dev": true, 309 | "requires": { 310 | "brace-expansion": "^1.1.7" 311 | } 312 | } 313 | } 314 | }, 315 | "glob-parent": { 316 | "version": "5.1.2", 317 | "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", 318 | "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", 319 | "dev": true, 320 | "requires": { 321 | "is-glob": "^4.0.1" 322 | } 323 | }, 324 | "has-flag": { 325 | "version": "4.0.0", 326 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", 327 | "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", 328 | "dev": true 329 | }, 330 | "he": { 331 | "version": "1.2.0", 332 | "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", 333 | "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", 334 | "dev": true 335 | }, 336 | "inflight": { 337 | "version": "1.0.6", 338 | "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", 339 | "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", 340 | "dev": true, 341 | "requires": { 342 | "once": "^1.3.0", 343 | "wrappy": "1" 344 | } 345 | }, 346 | "inherits": { 347 | "version": "2.0.4", 348 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 349 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", 350 | "dev": true 351 | }, 352 | "is-binary-path": { 353 | "version": "2.1.0", 354 | "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", 355 | "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", 356 | "dev": true, 357 | "requires": { 358 | "binary-extensions": "^2.0.0" 359 | } 360 | }, 361 | "is-extglob": { 362 | "version": "2.1.1", 363 | "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", 364 | "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", 365 | "dev": true 366 | }, 367 | "is-fullwidth-code-point": { 368 | "version": "3.0.0", 369 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", 370 | "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", 371 | "dev": true 372 | }, 373 | "is-glob": { 374 | "version": "4.0.3", 375 | "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", 376 | "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", 377 | "dev": true, 378 | "requires": { 379 | "is-extglob": "^2.1.1" 380 | } 381 | }, 382 | "is-number": { 383 | "version": "7.0.0", 384 | "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", 385 | "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", 386 | "dev": true 387 | }, 388 | "is-plain-obj": { 389 | "version": "2.1.0", 390 | "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", 391 | "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", 392 | "dev": true 393 | }, 394 | "is-unicode-supported": { 395 | "version": "0.1.0", 396 | "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", 397 | "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", 398 | "dev": true 399 | }, 400 | "js-yaml": { 401 | "version": "4.1.0", 402 | "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", 403 | "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", 404 | "dev": true, 405 | "requires": { 406 | "argparse": "^2.0.1" 407 | } 408 | }, 409 | "locate-path": { 410 | "version": "6.0.0", 411 | "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", 412 | "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", 413 | "dev": true, 414 | "requires": { 415 | "p-locate": "^5.0.0" 416 | } 417 | }, 418 | "log-symbols": { 419 | "version": "4.1.0", 420 | "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", 421 | "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", 422 | "dev": true, 423 | "requires": { 424 | "chalk": "^4.1.0", 425 | "is-unicode-supported": "^0.1.0" 426 | } 427 | }, 428 | "minimatch": { 429 | "version": "5.0.1", 430 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", 431 | "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", 432 | "dev": true, 433 | "requires": { 434 | "brace-expansion": "^2.0.1" 435 | }, 436 | "dependencies": { 437 | "brace-expansion": { 438 | "version": "2.0.1", 439 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", 440 | "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", 441 | "dev": true, 442 | "requires": { 443 | "balanced-match": "^1.0.0" 444 | } 445 | } 446 | } 447 | }, 448 | "mocha": { 449 | "version": "10.2.0", 450 | "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz", 451 | "integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==", 452 | "dev": true, 453 | "requires": { 454 | "ansi-colors": "4.1.1", 455 | "browser-stdout": "1.3.1", 456 | "chokidar": "3.5.3", 457 | "debug": "4.3.4", 458 | "diff": "5.0.0", 459 | "escape-string-regexp": "4.0.0", 460 | "find-up": "5.0.0", 461 | "glob": "7.2.0", 462 | "he": "1.2.0", 463 | "js-yaml": "4.1.0", 464 | "log-symbols": "4.1.0", 465 | "minimatch": "5.0.1", 466 | "ms": "2.1.3", 467 | "nanoid": "3.3.3", 468 | "serialize-javascript": "6.0.0", 469 | "strip-json-comments": "3.1.1", 470 | "supports-color": "8.1.1", 471 | "workerpool": "6.2.1", 472 | "yargs": "16.2.0", 473 | "yargs-parser": "20.2.4", 474 | "yargs-unparser": "2.0.0" 475 | } 476 | }, 477 | "ms": { 478 | "version": "2.1.3", 479 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", 480 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", 481 | "dev": true 482 | }, 483 | "nanoid": { 484 | "version": "3.3.3", 485 | "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", 486 | "integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==", 487 | "dev": true 488 | }, 489 | "normalize-path": { 490 | "version": "3.0.0", 491 | "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", 492 | "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", 493 | "dev": true 494 | }, 495 | "once": { 496 | "version": "1.4.0", 497 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 498 | "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", 499 | "dev": true, 500 | "requires": { 501 | "wrappy": "1" 502 | } 503 | }, 504 | "p-limit": { 505 | "version": "3.1.0", 506 | "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", 507 | "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", 508 | "dev": true, 509 | "requires": { 510 | "yocto-queue": "^0.1.0" 511 | } 512 | }, 513 | "p-locate": { 514 | "version": "5.0.0", 515 | "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", 516 | "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", 517 | "dev": true, 518 | "requires": { 519 | "p-limit": "^3.0.2" 520 | } 521 | }, 522 | "path-exists": { 523 | "version": "4.0.0", 524 | "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", 525 | "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", 526 | "dev": true 527 | }, 528 | "path-is-absolute": { 529 | "version": "1.0.1", 530 | "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", 531 | "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", 532 | "dev": true 533 | }, 534 | "pathval": { 535 | "version": "1.1.1", 536 | "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", 537 | "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", 538 | "dev": true 539 | }, 540 | "picomatch": { 541 | "version": "2.3.1", 542 | "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", 543 | "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", 544 | "dev": true 545 | }, 546 | "randombytes": { 547 | "version": "2.1.0", 548 | "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", 549 | "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", 550 | "dev": true, 551 | "requires": { 552 | "safe-buffer": "^5.1.0" 553 | } 554 | }, 555 | "readdirp": { 556 | "version": "3.6.0", 557 | "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", 558 | "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", 559 | "dev": true, 560 | "requires": { 561 | "picomatch": "^2.2.1" 562 | } 563 | }, 564 | "require-directory": { 565 | "version": "2.1.1", 566 | "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", 567 | "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", 568 | "dev": true 569 | }, 570 | "safe-buffer": { 571 | "version": "5.2.1", 572 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", 573 | "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", 574 | "dev": true 575 | }, 576 | "serialize-javascript": { 577 | "version": "6.0.0", 578 | "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", 579 | "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", 580 | "dev": true, 581 | "requires": { 582 | "randombytes": "^2.1.0" 583 | } 584 | }, 585 | "string-width": { 586 | "version": "4.2.3", 587 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", 588 | "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", 589 | "dev": true, 590 | "requires": { 591 | "emoji-regex": "^8.0.0", 592 | "is-fullwidth-code-point": "^3.0.0", 593 | "strip-ansi": "^6.0.1" 594 | } 595 | }, 596 | "strip-ansi": { 597 | "version": "6.0.1", 598 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", 599 | "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", 600 | "dev": true, 601 | "requires": { 602 | "ansi-regex": "^5.0.1" 603 | } 604 | }, 605 | "strip-json-comments": { 606 | "version": "3.1.1", 607 | "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", 608 | "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", 609 | "dev": true 610 | }, 611 | "supports-color": { 612 | "version": "8.1.1", 613 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", 614 | "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", 615 | "dev": true, 616 | "requires": { 617 | "has-flag": "^4.0.0" 618 | } 619 | }, 620 | "to-regex-range": { 621 | "version": "5.0.1", 622 | "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", 623 | "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", 624 | "dev": true, 625 | "requires": { 626 | "is-number": "^7.0.0" 627 | } 628 | }, 629 | "type-detect": { 630 | "version": "4.0.8", 631 | "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", 632 | "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", 633 | "dev": true 634 | }, 635 | "workerpool": { 636 | "version": "6.2.1", 637 | "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", 638 | "integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==", 639 | "dev": true 640 | }, 641 | "wrap-ansi": { 642 | "version": "7.0.0", 643 | "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", 644 | "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", 645 | "dev": true, 646 | "requires": { 647 | "ansi-styles": "^4.0.0", 648 | "string-width": "^4.1.0", 649 | "strip-ansi": "^6.0.0" 650 | } 651 | }, 652 | "wrappy": { 653 | "version": "1.0.2", 654 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 655 | "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", 656 | "dev": true 657 | }, 658 | "y18n": { 659 | "version": "5.0.8", 660 | "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", 661 | "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", 662 | "dev": true 663 | }, 664 | "yargs": { 665 | "version": "16.2.0", 666 | "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", 667 | "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", 668 | "dev": true, 669 | "requires": { 670 | "cliui": "^7.0.2", 671 | "escalade": "^3.1.1", 672 | "get-caller-file": "^2.0.5", 673 | "require-directory": "^2.1.1", 674 | "string-width": "^4.2.0", 675 | "y18n": "^5.0.5", 676 | "yargs-parser": "^20.2.2" 677 | } 678 | }, 679 | "yargs-parser": { 680 | "version": "20.2.4", 681 | "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", 682 | "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", 683 | "dev": true 684 | }, 685 | "yargs-unparser": { 686 | "version": "2.0.0", 687 | "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", 688 | "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", 689 | "dev": true, 690 | "requires": { 691 | "camelcase": "^6.0.0", 692 | "decamelize": "^4.0.0", 693 | "flat": "^5.0.2", 694 | "is-plain-obj": "^2.1.0" 695 | } 696 | }, 697 | "yocto-queue": { 698 | "version": "0.1.0", 699 | "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", 700 | "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", 701 | "dev": true 702 | } 703 | } 704 | } 705 | -------------------------------------------------------------------------------- /functions/stock-seller/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "stock_checker", 3 | "version": "1.0.0", 4 | "description": "Mock stock checker for NodeJS", 5 | "main": "app.js", 6 | "repository": "TODO", 7 | "author": "SAM CLI", 8 | "license": "MIT", 9 | "dependencies": {}, 10 | "scripts": { 11 | "test": "mocha tests/unit/" 12 | }, 13 | "devDependencies": { 14 | "chai": "^4.2.0", 15 | "mocha": "^10.2.0" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /repoResources/stateMachine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/example-step-functions-integration-api-gateway/68f515d37d0392eeddf148e78df814b52ff66490/repoResources/stateMachine.png -------------------------------------------------------------------------------- /statemachine/stock_trader.asl.json: -------------------------------------------------------------------------------- 1 | { 2 | "Comment": "A state machine that does mock stock trading.", 3 | "StartAt": "Check Stock Value", 4 | "States": { 5 | "Check Stock Value": { 6 | "Type": "Task", 7 | "Resource": "arn:aws:states:::apigateway:invoke", 8 | "Parameters": { 9 | "ApiEndpoint":"${APIEndPoint}", 10 | "Method":"GET", 11 | "Stage":"Prod", 12 | "Path":"${StockCheckPath}", 13 | "RequestBody.$":"$", 14 | "AuthType":"NO_AUTH" 15 | }, 16 | "Retry": [ 17 | { 18 | "ErrorEquals": [ 19 | "States.TaskFailed" 20 | ], 21 | "IntervalSeconds": 15, 22 | "MaxAttempts": 5, 23 | "BackoffRate": 1.5 24 | } 25 | ], 26 | "Next": "Buy or Sell?" 27 | }, 28 | "Buy or Sell?": { 29 | "Type": "Choice", 30 | "Choices": [ 31 | { 32 | "Variable": "$.ResponseBody.stock_price", 33 | "NumericLessThanEquals": 50, 34 | "Next": "Buy Stock" 35 | } 36 | ], 37 | "Default": "Sell Stock" 38 | }, 39 | "Sell Stock": { 40 | "Type": "Task", 41 | "Resource": "arn:aws:states:::apigateway:invoke", 42 | "Parameters": { 43 | "ApiEndpoint":"${APIEndPoint}", 44 | "Method":"POST", 45 | "Stage":"Prod", 46 | "Path":"${StockSellPath}", 47 | "RequestBody.$":"$.ResponseBody", 48 | "AuthType":"NO_AUTH" 49 | }, 50 | "Retry": [ 51 | { 52 | "ErrorEquals": [ 53 | "States.TaskFailed" 54 | ], 55 | "IntervalSeconds": 2, 56 | "MaxAttempts": 3, 57 | "BackoffRate": 1 58 | } 59 | ], 60 | "Next": "Record Transaction" 61 | }, 62 | "Buy Stock": { 63 | "Type": "Task", 64 | "Resource": "arn:aws:states:::apigateway:invoke", 65 | "Parameters": { 66 | "ApiEndpoint":"${APIEndPoint}", 67 | "Method":"POST", 68 | "Stage":"Prod", 69 | "Path":"${StockBuyPath}", 70 | "RequestBody.$":"$.ResponseBody", 71 | "AuthType":"NO_AUTH" 72 | }, 73 | "Retry": [ 74 | { 75 | "ErrorEquals": [ 76 | "States.TaskFailed" 77 | ], 78 | "IntervalSeconds": 2, 79 | "MaxAttempts": 3, 80 | "BackoffRate": 1 81 | } 82 | ], 83 | "Next": "Record Transaction" 84 | }, 85 | "Record Transaction": { 86 | "Type": "Task", 87 | "Resource": "${DDBPutItem}", 88 | "Parameters": { 89 | "TableName": "${DDBTable}", 90 | "Item": { 91 | "Id": { 92 | "S.$": "$.ResponseBody.id" 93 | }, 94 | "Type": { 95 | "S.$": "$.ResponseBody.type" 96 | }, 97 | "Price": { 98 | "N.$": "$.ResponseBody.price" 99 | }, 100 | "Quantity": { 101 | "N.$": "$.ResponseBody.qty" 102 | }, 103 | "Timestamp": { 104 | "S.$": "$.ResponseBody.timestamp" 105 | } 106 | } 107 | }, 108 | "Retry": [ 109 | { 110 | "ErrorEquals": [ 111 | "States.TaskFailed" 112 | ], 113 | "IntervalSeconds": 20, 114 | "MaxAttempts": 5, 115 | "BackoffRate": 10 116 | } 117 | ], 118 | "End": true 119 | } 120 | } 121 | } -------------------------------------------------------------------------------- /template.yaml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: "2010-09-09" 2 | Transform: AWS::Serverless-2016-10-31 3 | Description: > 4 | sfn-apigw-example 5 | 6 | Sample SAM Template for sfn-apigw-example 7 | 8 | Parameters: 9 | BuyPath: 10 | Type: String 11 | Default: /buy 12 | SellPath: 13 | Type: String 14 | Default: /sell 15 | CheckPath: 16 | Type: String 17 | Default: /check 18 | 19 | Resources: 20 | StockTradingStateMachine: 21 | Type: AWS::Serverless::StateMachine # More info about State Machine Resource: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-statemachine.html 22 | Properties: 23 | DefinitionUri: statemachine/stock_trader.asl.json 24 | DefinitionSubstitutions: 25 | StockCheckPath: !Ref CheckPath 26 | StockSellPath: !Ref SellPath 27 | StockBuyPath: !Ref BuyPath 28 | APIEndPoint: !Sub "${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com" 29 | DDBPutItem: !Sub arn:${AWS::Partition}:states:::dynamodb:putItem 30 | DDBTable: !Ref TransactionTable 31 | Events: 32 | HourlyTradingSchedule: 33 | Type: Schedule # More info about Schedule Event Source: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-property-statemachine-schedule.html 34 | Properties: 35 | Description: Schedule to run the stock trading state machine every hour 36 | Enabled: False # This schedule is disabled by default to avoid incurring charges. 37 | Schedule: "rate(1 hour)" 38 | Policies: # Find out more about SAM policy templates: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-policy-templates.html 39 | - LambdaInvokePolicy: 40 | FunctionName: !Ref StockCheckerFunction 41 | - LambdaInvokePolicy: 42 | FunctionName: !Ref StockSellerFunction 43 | - LambdaInvokePolicy: 44 | FunctionName: !Ref StockBuyerFunction 45 | - DynamoDBWritePolicy: 46 | TableName: !Ref TransactionTable 47 | 48 | StockCheckerFunction: 49 | Type: AWS::Serverless::Function # More info about Function Resource: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html 50 | Properties: 51 | CodeUri: functions/stock-checker/ 52 | Handler: app.lambdaHandler 53 | Runtime: nodejs14.x 54 | Events: 55 | Api: 56 | Type: Api 57 | Properties: 58 | Path: /check 59 | Method: GET 60 | 61 | StockSellerFunction: 62 | Type: AWS::Serverless::Function 63 | Properties: 64 | CodeUri: functions/stock-seller/ 65 | Handler: app.lambdaHandler 66 | Runtime: nodejs14.x 67 | Events: 68 | Api: 69 | Type: Api 70 | Properties: 71 | Path: /sell 72 | Method: POST 73 | 74 | StockBuyerFunction: 75 | Type: AWS::Serverless::Function 76 | Properties: 77 | CodeUri: functions/stock-buyer/ 78 | Handler: app.lambdaHandler 79 | Runtime: nodejs14.x 80 | Events: 81 | Api: 82 | Type: Api 83 | Properties: 84 | Path: /buy 85 | Method: POST 86 | 87 | TransactionTable: 88 | Type: AWS::Serverless::SimpleTable # More info about SimpleTable Resource: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-simpletable.html 89 | Properties: 90 | PrimaryKey: 91 | Name: Id 92 | Type: String 93 | ProvisionedThroughput: 94 | ReadCapacityUnits: 1 95 | WriteCapacityUnits: 1 96 | 97 | Outputs: 98 | # StockTradingStateMachineHourlyTradingSchedule is an implicit Schedule event rule created out of Events key under Serverless::StateMachine 99 | # Find out more about other implicit resources you can reference within SAM 100 | # https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-specification-generated-resources.html 101 | StockTradingStateMachineArn: 102 | Description: "Stock Trading state machine ARN" 103 | Value: !Ref StockTradingStateMachine 104 | StockTradingStateMachineRole: 105 | Description: "IAM Role created for Stock Trading state machine based on the specified SAM Policy Templates" 106 | Value: !GetAtt StockTradingStateMachineRole.Arn 107 | WebEndpoint: 108 | Description: "API Gateway endpoint URL for Prod stage" 109 | Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/" 110 | --------------------------------------------------------------------------------