From 8f865547c4e87b47df5eb1de7481988772cdc018 Mon Sep 17 00:00:00 2001 From: ljacobsson Date: Wed, 9 Aug 2023 15:32:03 +0200 Subject: [PATCH] fix --- package-lock.json | 195 ++++++++++++++++-- package.json | 3 +- .../runtime-support/python/entrypoint.py | 35 +++- .../python/ide-support/vscode/launch.json | 2 +- 4 files changed, 216 insertions(+), 19 deletions(-) diff --git a/package-lock.json b/package-lock.json index eb25dd7..b5a2fe3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "samp-cli", - "version": "1.0.28", + "version": "1.0.33", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "samp-cli", - "version": "1.0.28", + "version": "1.0.33", "license": "ISC", "dependencies": { "@aws-sdk/client-cloudformation": "^3.319.0", @@ -16,6 +16,7 @@ "@aws-sdk/client-sfn": "^3.359.0", "@aws-sdk/client-sts": "^3.379.1", "@aws-sdk/credential-provider-sso": "^3.319.0", + "@aws-sdk/shared-ini-file-loader": "^3.374.0", "@mhlabs/iam-policies-cli": "^1.0.5", "@octokit/rest": "^18.5.2", "archiver": "^5.3.1", @@ -1303,6 +1304,18 @@ "node": ">=14.0.0" } }, + "node_modules/@aws-sdk/credential-provider-ini/node_modules/@aws-sdk/shared-ini-file-loader": { + "version": "3.357.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/shared-ini-file-loader/-/shared-ini-file-loader-3.357.0.tgz", + "integrity": "sha512-ceyqM4XxQe0Plb/oQAD2t1UOV2Iy4PFe1oAGM8dfJzYrRKu7zvMwru7/WaB3NYq+/mIY6RU+jjhRmjQ3GySVqA==", + "dependencies": { + "@aws-sdk/types": "3.357.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/@aws-sdk/credential-provider-node": { "version": "3.362.0", "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.362.0.tgz", @@ -1323,6 +1336,18 @@ "node": ">=14.0.0" } }, + "node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/shared-ini-file-loader": { + "version": "3.357.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/shared-ini-file-loader/-/shared-ini-file-loader-3.357.0.tgz", + "integrity": "sha512-ceyqM4XxQe0Plb/oQAD2t1UOV2Iy4PFe1oAGM8dfJzYrRKu7zvMwru7/WaB3NYq+/mIY6RU+jjhRmjQ3GySVqA==", + "dependencies": { + "@aws-sdk/types": "3.357.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/@aws-sdk/credential-provider-process": { "version": "3.357.0", "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-process/-/credential-provider-process-3.357.0.tgz", @@ -1337,6 +1362,18 @@ "node": ">=14.0.0" } }, + "node_modules/@aws-sdk/credential-provider-process/node_modules/@aws-sdk/shared-ini-file-loader": { + "version": "3.357.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/shared-ini-file-loader/-/shared-ini-file-loader-3.357.0.tgz", + "integrity": "sha512-ceyqM4XxQe0Plb/oQAD2t1UOV2Iy4PFe1oAGM8dfJzYrRKu7zvMwru7/WaB3NYq+/mIY6RU+jjhRmjQ3GySVqA==", + "dependencies": { + "@aws-sdk/types": "3.357.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/@aws-sdk/credential-provider-sso": { "version": "3.362.0", "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.362.0.tgz", @@ -1353,6 +1390,18 @@ "node": ">=14.0.0" } }, + "node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/shared-ini-file-loader": { + "version": "3.357.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/shared-ini-file-loader/-/shared-ini-file-loader-3.357.0.tgz", + "integrity": "sha512-ceyqM4XxQe0Plb/oQAD2t1UOV2Iy4PFe1oAGM8dfJzYrRKu7zvMwru7/WaB3NYq+/mIY6RU+jjhRmjQ3GySVqA==", + "dependencies": { + "@aws-sdk/types": "3.357.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/@aws-sdk/credential-provider-web-identity": { "version": "3.357.0", "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.357.0.tgz", @@ -1690,6 +1739,18 @@ "node": ">=14.0.0" } }, + "node_modules/@aws-sdk/node-config-provider/node_modules/@aws-sdk/shared-ini-file-loader": { + "version": "3.357.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/shared-ini-file-loader/-/shared-ini-file-loader-3.357.0.tgz", + "integrity": "sha512-ceyqM4XxQe0Plb/oQAD2t1UOV2Iy4PFe1oAGM8dfJzYrRKu7zvMwru7/WaB3NYq+/mIY6RU+jjhRmjQ3GySVqA==", + "dependencies": { + "@aws-sdk/types": "3.357.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/@aws-sdk/node-http-handler": { "version": "3.360.0", "resolved": "https://registry.npmjs.org/@aws-sdk/node-http-handler/-/node-http-handler-3.360.0.tgz", @@ -1763,11 +1824,24 @@ } }, "node_modules/@aws-sdk/shared-ini-file-loader": { - "version": "3.357.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/shared-ini-file-loader/-/shared-ini-file-loader-3.357.0.tgz", - "integrity": "sha512-ceyqM4XxQe0Plb/oQAD2t1UOV2Iy4PFe1oAGM8dfJzYrRKu7zvMwru7/WaB3NYq+/mIY6RU+jjhRmjQ3GySVqA==", + "version": "3.374.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/shared-ini-file-loader/-/shared-ini-file-loader-3.374.0.tgz", + "integrity": "sha512-r3mNf+GAsnJQGh2nssPIXdOMKSn/6v1vPPWEHC2Dy0uxVdeBRxlJLVGPt4QtlwX2dT2hnIttUh/vY9yuJRP4kg==", + "deprecated": "This package has moved to @smithy/shared-ini-file-loader", "dependencies": { - "@aws-sdk/types": "3.357.0", + "@smithy/shared-ini-file-loader": "^1.0.1", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/shared-ini-file-loader/node_modules/@smithy/shared-ini-file-loader": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@smithy/shared-ini-file-loader/-/shared-ini-file-loader-1.1.0.tgz", + "integrity": "sha512-S/v33zvCWzFyGZGlsEF0XsZtNNR281UhR7byk3nRfsgw5lGpg51rK/zjMgulM+h6NSuXaFILaYrw1I1v4kMcuA==", + "dependencies": { + "@smithy/types": "^1.2.0", "tslib": "^2.5.0" }, "engines": { @@ -1822,6 +1896,18 @@ "node": ">=14.0.0" } }, + "node_modules/@aws-sdk/token-providers/node_modules/@aws-sdk/shared-ini-file-loader": { + "version": "3.357.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/shared-ini-file-loader/-/shared-ini-file-loader-3.357.0.tgz", + "integrity": "sha512-ceyqM4XxQe0Plb/oQAD2t1UOV2Iy4PFe1oAGM8dfJzYrRKu7zvMwru7/WaB3NYq+/mIY6RU+jjhRmjQ3GySVqA==", + "dependencies": { + "@aws-sdk/types": "3.357.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/@aws-sdk/types": { "version": "3.357.0", "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.357.0.tgz", @@ -3821,9 +3907,9 @@ } }, "node_modules/@smithy/types": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@smithy/types/-/types-1.1.0.tgz", - "integrity": "sha512-KzmvisMmuwD2jZXuC9e65JrgsZM97y5NpDU7g347oB+Q+xQLU6hQZ5zFNNbEfwwOJHoOvEVTna+dk1h/lW7alw==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@smithy/types/-/types-1.2.0.tgz", + "integrity": "sha512-z1r00TvBqF3dh4aHhya7nz1HhvCg4TRmw51fjMrh5do3h+ngSstt/yKlNbHeb9QxJmFbmN8KEVSWgb1bRvfEoA==", "dependencies": { "tslib": "^2.5.0" }, @@ -12754,6 +12840,17 @@ "@aws-sdk/shared-ini-file-loader": "3.357.0", "@aws-sdk/types": "3.357.0", "tslib": "^2.5.0" + }, + "dependencies": { + "@aws-sdk/shared-ini-file-loader": { + "version": "3.357.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/shared-ini-file-loader/-/shared-ini-file-loader-3.357.0.tgz", + "integrity": "sha512-ceyqM4XxQe0Plb/oQAD2t1UOV2Iy4PFe1oAGM8dfJzYrRKu7zvMwru7/WaB3NYq+/mIY6RU+jjhRmjQ3GySVqA==", + "requires": { + "@aws-sdk/types": "3.357.0", + "tslib": "^2.5.0" + } + } } }, "@aws-sdk/credential-provider-node": { @@ -12771,6 +12868,17 @@ "@aws-sdk/shared-ini-file-loader": "3.357.0", "@aws-sdk/types": "3.357.0", "tslib": "^2.5.0" + }, + "dependencies": { + "@aws-sdk/shared-ini-file-loader": { + "version": "3.357.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/shared-ini-file-loader/-/shared-ini-file-loader-3.357.0.tgz", + "integrity": "sha512-ceyqM4XxQe0Plb/oQAD2t1UOV2Iy4PFe1oAGM8dfJzYrRKu7zvMwru7/WaB3NYq+/mIY6RU+jjhRmjQ3GySVqA==", + "requires": { + "@aws-sdk/types": "3.357.0", + "tslib": "^2.5.0" + } + } } }, "@aws-sdk/credential-provider-process": { @@ -12782,6 +12890,17 @@ "@aws-sdk/shared-ini-file-loader": "3.357.0", "@aws-sdk/types": "3.357.0", "tslib": "^2.5.0" + }, + "dependencies": { + "@aws-sdk/shared-ini-file-loader": { + "version": "3.357.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/shared-ini-file-loader/-/shared-ini-file-loader-3.357.0.tgz", + "integrity": "sha512-ceyqM4XxQe0Plb/oQAD2t1UOV2Iy4PFe1oAGM8dfJzYrRKu7zvMwru7/WaB3NYq+/mIY6RU+jjhRmjQ3GySVqA==", + "requires": { + "@aws-sdk/types": "3.357.0", + "tslib": "^2.5.0" + } + } } }, "@aws-sdk/credential-provider-sso": { @@ -12795,6 +12914,17 @@ "@aws-sdk/token-providers": "3.362.0", "@aws-sdk/types": "3.357.0", "tslib": "^2.5.0" + }, + "dependencies": { + "@aws-sdk/shared-ini-file-loader": { + "version": "3.357.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/shared-ini-file-loader/-/shared-ini-file-loader-3.357.0.tgz", + "integrity": "sha512-ceyqM4XxQe0Plb/oQAD2t1UOV2Iy4PFe1oAGM8dfJzYrRKu7zvMwru7/WaB3NYq+/mIY6RU+jjhRmjQ3GySVqA==", + "requires": { + "@aws-sdk/types": "3.357.0", + "tslib": "^2.5.0" + } + } } }, "@aws-sdk/credential-provider-web-identity": { @@ -13065,6 +13195,17 @@ "@aws-sdk/shared-ini-file-loader": "3.357.0", "@aws-sdk/types": "3.357.0", "tslib": "^2.5.0" + }, + "dependencies": { + "@aws-sdk/shared-ini-file-loader": { + "version": "3.357.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/shared-ini-file-loader/-/shared-ini-file-loader-3.357.0.tgz", + "integrity": "sha512-ceyqM4XxQe0Plb/oQAD2t1UOV2Iy4PFe1oAGM8dfJzYrRKu7zvMwru7/WaB3NYq+/mIY6RU+jjhRmjQ3GySVqA==", + "requires": { + "@aws-sdk/types": "3.357.0", + "tslib": "^2.5.0" + } + } } }, "@aws-sdk/node-http-handler": { @@ -13122,12 +13263,23 @@ "integrity": "sha512-VuXeL4g5vKO9HjgCZlxmH8Uv1FcqUSjmbPpQkbNtYIDck6u0qzM0rG+n0/1EjyQbPSr3MhW/pkWs5nx2Nljlyg==" }, "@aws-sdk/shared-ini-file-loader": { - "version": "3.357.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/shared-ini-file-loader/-/shared-ini-file-loader-3.357.0.tgz", - "integrity": "sha512-ceyqM4XxQe0Plb/oQAD2t1UOV2Iy4PFe1oAGM8dfJzYrRKu7zvMwru7/WaB3NYq+/mIY6RU+jjhRmjQ3GySVqA==", + "version": "3.374.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/shared-ini-file-loader/-/shared-ini-file-loader-3.374.0.tgz", + "integrity": "sha512-r3mNf+GAsnJQGh2nssPIXdOMKSn/6v1vPPWEHC2Dy0uxVdeBRxlJLVGPt4QtlwX2dT2hnIttUh/vY9yuJRP4kg==", "requires": { - "@aws-sdk/types": "3.357.0", + "@smithy/shared-ini-file-loader": "^1.0.1", "tslib": "^2.5.0" + }, + "dependencies": { + "@smithy/shared-ini-file-loader": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@smithy/shared-ini-file-loader/-/shared-ini-file-loader-1.1.0.tgz", + "integrity": "sha512-S/v33zvCWzFyGZGlsEF0XsZtNNR281UhR7byk3nRfsgw5lGpg51rK/zjMgulM+h6NSuXaFILaYrw1I1v4kMcuA==", + "requires": { + "@smithy/types": "^1.2.0", + "tslib": "^2.5.0" + } + } } }, "@aws-sdk/signature-v4": { @@ -13167,6 +13319,17 @@ "@aws-sdk/shared-ini-file-loader": "3.357.0", "@aws-sdk/types": "3.357.0", "tslib": "^2.5.0" + }, + "dependencies": { + "@aws-sdk/shared-ini-file-loader": { + "version": "3.357.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/shared-ini-file-loader/-/shared-ini-file-loader-3.357.0.tgz", + "integrity": "sha512-ceyqM4XxQe0Plb/oQAD2t1UOV2Iy4PFe1oAGM8dfJzYrRKu7zvMwru7/WaB3NYq+/mIY6RU+jjhRmjQ3GySVqA==", + "requires": { + "@aws-sdk/types": "3.357.0", + "tslib": "^2.5.0" + } + } } }, "@aws-sdk/types": { @@ -14774,9 +14937,9 @@ } }, "@smithy/types": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@smithy/types/-/types-1.1.0.tgz", - "integrity": "sha512-KzmvisMmuwD2jZXuC9e65JrgsZM97y5NpDU7g347oB+Q+xQLU6hQZ5zFNNbEfwwOJHoOvEVTna+dk1h/lW7alw==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@smithy/types/-/types-1.2.0.tgz", + "integrity": "sha512-z1r00TvBqF3dh4aHhya7nz1HhvCg4TRmw51fjMrh5do3h+ngSstt/yKlNbHeb9QxJmFbmN8KEVSWgb1bRvfEoA==", "requires": { "tslib": "^2.5.0" } diff --git a/package.json b/package.json index 8136c7c..35f0c24 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "samp-cli", - "version": "1.0.33", + "version": "1.0.34", "description": "CLI tool for extended productivity with AWS Serverless Application Model (SAM)", "main": "index.js", "scripts": { @@ -37,6 +37,7 @@ "@aws-sdk/client-sfn": "^3.359.0", "@aws-sdk/client-sts": "^3.379.1", "@aws-sdk/credential-provider-sso": "^3.319.0", + "@aws-sdk/shared-ini-file-loader": "^3.374.0", "@mhlabs/iam-policies-cli": "^1.0.5", "@octokit/rest": "^18.5.2", "archiver": "^5.3.1", diff --git a/src/commands/local/runtime-support/python/entrypoint.py b/src/commands/local/runtime-support/python/entrypoint.py index b50862a..2d04765 100644 --- a/src/commands/local/runtime-support/python/entrypoint.py +++ b/src/commands/local/runtime-support/python/entrypoint.py @@ -1,5 +1,6 @@ import importlib.util import os +import re import time import json from watchdog.observers import Observer @@ -40,12 +41,36 @@ def run_function_from_module(data, path): if hasattr(module, function_name): func = getattr(module, function_name) - response = func(data["obj"]["event"], data["obj"]["context"]) + context = DictToObject(convert_camel_to_snake(data["obj"]["context"])) + response = func(data["obj"]["event"], context) response_file_path = path.replace("samp-requests", "samp-responses") with open(response_file_path, "w") as response_file: response_file.write(json.dumps(response)) else: print(f"Function '{function_name}' not found in module '{module_name}'") + +def camel_to_snake(name): + return re.sub(r'(?