From 1033f8f93e76770b6aabb487640e83a481998399 Mon Sep 17 00:00:00 2001 From: rkathir-solink Date: Tue, 15 Jun 2021 16:22:06 -0400 Subject: [PATCH 01/41] initial updateItem commit --- package-lock.json | 30 +++++++++++++++++++++++++++++ package.json | 3 ++- src/operations/index.ts | 1 + src/operations/update.ts | 41 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 src/operations/update.ts diff --git a/package-lock.json b/package-lock.json index 0d88e5b0..e353802b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -858,6 +858,24 @@ } } }, + "@sideway/address": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.2.tgz", + "integrity": "sha512-idTz8ibqWFrPU8kMirL0CoPH/A29XOzzAzpyN3zQ4kAWnzmNfFmRaoMNN6VI8ske5M73HZyhIaW4OuSFIdM4oA==", + "requires": { + "@hapi/hoek": "^9.0.0" + } + }, + "@sideway/formula": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.0.tgz", + "integrity": "sha512-vHe7wZ4NOXVfkoRb8T5otiENVlT7a3IAiw7H5M2+GO+9CDgcVUUsX1zalAztCmwyOr2RUTGJdgB+ZvSVqmdHmg==" + }, + "@sideway/pinpoint": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz", + "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==" + }, "@tootallnate/once": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", @@ -2812,6 +2830,18 @@ "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.15.0.tgz", "integrity": "sha1-o/Iiqarp+Wb10nx5ZRDigJF2Qhc=" }, + "joi": { + "version": "17.4.0", + "resolved": "https://registry.npmjs.org/joi/-/joi-17.4.0.tgz", + "integrity": "sha512-F4WiW2xaV6wc1jxete70Rw4V/VuMd6IN+a5ilZsxG4uYtUXWu2kq9W5P2dz30e7Gmw8RCbY/u/uk+dMPma9tAg==", + "requires": { + "@hapi/hoek": "^9.0.0", + "@hapi/topo": "^5.0.0", + "@sideway/address": "^4.1.0", + "@sideway/formula": "^3.0.0", + "@sideway/pinpoint": "^2.0.0" + } + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", diff --git a/package.json b/package.json index fa95b3d4..73040128 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,8 @@ "@actions/core": "^1.2.6", "@actions/glob": "^0.2.0", "@hapi/joi": "^17.1.1", - "aws-sdk": "^2.703.0" + "aws-sdk": "^2.703.0", + "joi": "^17.4.0" }, "config": { "commitizen": { diff --git a/src/operations/index.ts b/src/operations/index.ts index 7e9d7930..fb92659d 100644 --- a/src/operations/index.ts +++ b/src/operations/index.ts @@ -4,3 +4,4 @@ export * from "./batch-put"; export * from "./delete"; export * from "./get"; export * from "./put"; +export * from "./update"; diff --git a/src/operations/update.ts b/src/operations/update.ts new file mode 100644 index 00000000..b19ec80b --- /dev/null +++ b/src/operations/update.ts @@ -0,0 +1,41 @@ +import * as Joi from "@hapi/joi"; +import { createClient } from "../helpers"; +import { Operation } from "./base"; + +const InputSchema = Joi.object({ + operation: Joi.string().lowercase().valid("get").required(), + region: Joi.string().lowercase().required(), + table: Joi.string().required(), + existingKey: Joi.object().pattern(/./, Joi.alternatives().try(Joi.string(), Joi.number())).min(1).max(2).required(), + constRead: Joi.boolean().default(false).optional(), +}).required(); + +interface UpdateOperationInput { + operation: "update"; + region: string; + table: string; + existingKey: { [key: string]: string | number }; +} + +export class UpdateOperation implements Operation { + public readonly name = "get"; + + public async validate(input: unknown): Promise { + const validationResult = InputSchema.validate(input, { + stripUnknown: true, + }); + if (validationResult.error) { + throw validationResult.error; + } + + return validationResult.value as UpdateOperationInput; + } + + public async execute(input: UpdateOperationInput) { + const ddb = createClient(input.region); + const res = await ddb.update({ + TableName: input.table, + Key: input.existingKey, + }).promise(); + } +} \ No newline at end of file From a48e898473c625498d9dfb1d99d1b55dbab58863 Mon Sep 17 00:00:00 2001 From: rkathir-solink Date: Tue, 15 Jun 2021 16:32:13 -0400 Subject: [PATCH 02/41] add update operation --- src/index.ts | 3 +++ src/operations/update.ts | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 4478b85c..13e7e3dd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -23,6 +23,9 @@ const processor = new Processor(); // BatchPut Operation items: forgivingJSONParse(core.getInput("items")), files: core.getInput("files"), + + // Update Operation + existingKey: forgivingJSONParse(core.getInput("existingKey")), }; const output = await processor.process(input); diff --git a/src/operations/update.ts b/src/operations/update.ts index b19ec80b..ce5a52df 100644 --- a/src/operations/update.ts +++ b/src/operations/update.ts @@ -7,7 +7,6 @@ const InputSchema = Joi.object({ region: Joi.string().lowercase().required(), table: Joi.string().required(), existingKey: Joi.object().pattern(/./, Joi.alternatives().try(Joi.string(), Joi.number())).min(1).max(2).required(), - constRead: Joi.boolean().default(false).optional(), }).required(); interface UpdateOperationInput { From 0d299a4130955a48ccc99e2dfaed55ac70b1f43b Mon Sep 17 00:00:00 2001 From: rkathir-solink Date: Fri, 18 Jun 2021 16:19:15 -0400 Subject: [PATCH 03/41] label update --- src/operations/update.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/operations/update.ts b/src/operations/update.ts index ce5a52df..0761510b 100644 --- a/src/operations/update.ts +++ b/src/operations/update.ts @@ -17,7 +17,7 @@ interface UpdateOperationInput { } export class UpdateOperation implements Operation { - public readonly name = "get"; + public readonly name = "update"; public async validate(input: unknown): Promise { const validationResult = InputSchema.validate(input, { From 251ffa4573e9834642ab17d2bff8fdac204d2321 Mon Sep 17 00:00:00 2001 From: rkathir-solink <83596272+rkathir-solink@users.noreply.github.com> Date: Mon, 21 Jun 2021 15:59:56 -0400 Subject: [PATCH 04/41] change input name --- src/operations/update.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/operations/update.ts b/src/operations/update.ts index ce5a52df..3c7bff1a 100644 --- a/src/operations/update.ts +++ b/src/operations/update.ts @@ -6,14 +6,14 @@ const InputSchema = Joi.object({ operation: Joi.string().lowercase().valid("get").required(), region: Joi.string().lowercase().required(), table: Joi.string().required(), - existingKey: Joi.object().pattern(/./, Joi.alternatives().try(Joi.string(), Joi.number())).min(1).max(2).required(), + key: Joi.object().pattern(/./, Joi.alternatives().try(Joi.string(), Joi.number())).min(1).max(2).required(), }).required(); interface UpdateOperationInput { operation: "update"; region: string; table: string; - existingKey: { [key: string]: string | number }; + key: { [key: string]: string | number }; } export class UpdateOperation implements Operation { @@ -34,7 +34,7 @@ export class UpdateOperation implements Operation { const ddb = createClient(input.region); const res = await ddb.update({ TableName: input.table, - Key: input.existingKey, + Key: input.key, }).promise(); } -} \ No newline at end of file +} From eac44dbdcfa013bd31a49e64997239dcec0ebdc3 Mon Sep 17 00:00:00 2001 From: rkathir-solink <83596272+rkathir-solink@users.noreply.github.com> Date: Mon, 21 Jun 2021 16:10:10 -0400 Subject: [PATCH 05/41] update.ts bug fix --- src/operations/update.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/operations/update.ts b/src/operations/update.ts index 3c7bff1a..a831dbeb 100644 --- a/src/operations/update.ts +++ b/src/operations/update.ts @@ -3,7 +3,7 @@ import { createClient } from "../helpers"; import { Operation } from "./base"; const InputSchema = Joi.object({ - operation: Joi.string().lowercase().valid("get").required(), + operation: Joi.string().lowercase().valid("update").required(), region: Joi.string().lowercase().required(), table: Joi.string().required(), key: Joi.object().pattern(/./, Joi.alternatives().try(Joi.string(), Joi.number())).min(1).max(2).required(), @@ -17,7 +17,7 @@ interface UpdateOperationInput { } export class UpdateOperation implements Operation { - public readonly name = "get"; + public readonly name = "update"; public async validate(input: unknown): Promise { const validationResult = InputSchema.validate(input, { From b05bf3c4751fce195eb2be28cdf313c3ed6ba68b Mon Sep 17 00:00:00 2001 From: rkathir-solink <83596272+rkathir-solink@users.noreply.github.com> Date: Mon, 21 Jun 2021 16:13:17 -0400 Subject: [PATCH 06/41] remove unnecessary core.getInput command --- src/index.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index 13e7e3dd..6a58ba01 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,7 +12,7 @@ const processor = new Processor(); region: core.getInput("region"), table: core.getInput("table"), - // Get / Delete Operation + // Get / Delete / Update Operation key: forgivingJSONParse(core.getInput("key")), consistent: forgivingJSONParse(core.getInput("consistent")), @@ -23,9 +23,6 @@ const processor = new Processor(); // BatchPut Operation items: forgivingJSONParse(core.getInput("items")), files: core.getInput("files"), - - // Update Operation - existingKey: forgivingJSONParse(core.getInput("existingKey")), }; const output = await processor.process(input); From 1185185fb149a3f7aa3fbabaebcf7a575855b9ed Mon Sep 17 00:00:00 2001 From: rkathir-solink <83596272+rkathir-solink@users.noreply.github.com> Date: Mon, 21 Jun 2021 17:03:26 -0400 Subject: [PATCH 07/41] Update update.ts --- src/operations/update.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/operations/update.ts b/src/operations/update.ts index a831dbeb..b2116045 100644 --- a/src/operations/update.ts +++ b/src/operations/update.ts @@ -7,6 +7,7 @@ const InputSchema = Joi.object({ region: Joi.string().lowercase().required(), table: Joi.string().required(), key: Joi.object().pattern(/./, Joi.alternatives().try(Joi.string(), Joi.number())).min(1).max(2).required(), + consistent: Joi.boolean().default(false).optional(), }).required(); interface UpdateOperationInput { @@ -14,6 +15,7 @@ interface UpdateOperationInput { region: string; table: string; key: { [key: string]: string | number }; + consistent: boolean; } export class UpdateOperation implements Operation { From fe700d3cc280b98309f6f82a7b752bfbd3ef4790 Mon Sep 17 00:00:00 2001 From: rkathir-solink <83596272+rkathir-solink@users.noreply.github.com> Date: Mon, 21 Jun 2021 17:05:20 -0400 Subject: [PATCH 08/41] include update.ts --- src/processor.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/processor.ts b/src/processor.ts index 009b6ea2..b5a6115f 100644 --- a/src/processor.ts +++ b/src/processor.ts @@ -1,6 +1,6 @@ import { Operation, Output } from "./operations"; -import { BatchPutOperation, DeleteOperation, GetOperation, PutOperation } from "./operations"; +import { BatchPutOperation, DeleteOperation, GetOperation, PutOperation, UpdateOperation } from "./operations"; export class Processor { public operations: Operation[] = [ @@ -8,6 +8,7 @@ export class Processor { new DeleteOperation(), new GetOperation(), new PutOperation(), + new UpdateOperation() ]; public async process(input: { From 8b758b2f335ca5b17061cb4d5ee676087d0c81b3 Mon Sep 17 00:00:00 2001 From: rkathir-solink <83596272+rkathir-solink@users.noreply.github.com> Date: Mon, 21 Jun 2021 17:46:27 -0400 Subject: [PATCH 09/41] invoke await for update --- src/operations/get.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/operations/get.ts b/src/operations/get.ts index eec96bf0..d7116271 100644 --- a/src/operations/get.ts +++ b/src/operations/get.ts @@ -34,7 +34,7 @@ export class GetOperation implements Operation { public async execute(input: GetOperationInput) { const ddb = createClient(input.region); - const res = await ddb.get({ + await ddb.get({ TableName: input.table, Key: input.key, ConsistentRead: !!input.consistent, From fc009df5860a7e3e684df177e33e0727b573a16e Mon Sep 17 00:00:00 2001 From: rkathir-solink <83596272+rkathir-solink@users.noreply.github.com> Date: Mon, 21 Jun 2021 17:52:26 -0400 Subject: [PATCH 10/41] Update update.ts --- src/operations/update.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/operations/update.ts b/src/operations/update.ts index b2116045..ba3310db 100644 --- a/src/operations/update.ts +++ b/src/operations/update.ts @@ -34,7 +34,7 @@ export class UpdateOperation implements Operation { public async execute(input: UpdateOperationInput) { const ddb = createClient(input.region); - const res = await ddb.update({ + await ddb.update({ TableName: input.table, Key: input.key, }).promise(); From 3f96a21511329121d22da8f34764d8b3653ce6a5 Mon Sep 17 00:00:00 2001 From: rkathir-solink <83596272+rkathir-solink@users.noreply.github.com> Date: Mon, 21 Jun 2021 17:53:25 -0400 Subject: [PATCH 11/41] revert --- src/operations/get.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/operations/get.ts b/src/operations/get.ts index d7116271..eec96bf0 100644 --- a/src/operations/get.ts +++ b/src/operations/get.ts @@ -34,7 +34,7 @@ export class GetOperation implements Operation { public async execute(input: GetOperationInput) { const ddb = createClient(input.region); - await ddb.get({ + const res = await ddb.get({ TableName: input.table, Key: input.key, ConsistentRead: !!input.consistent, From ba3cb239bacaaad9572020144c63eeeb25d192a3 Mon Sep 17 00:00:00 2001 From: rkathir-solink Date: Tue, 22 Jun 2021 09:06:48 -0400 Subject: [PATCH 12/41] tsc.cmd changes --- dist/index.js | 2 +- dist/operations/index.js | 3 +- dist/operations/update.js | 34 ++++ dist/processor.js | 1 + package-lock.json | 317 +++++++++++++++++++++++++++++++++++--- package.json | 4 +- 6 files changed, 340 insertions(+), 21 deletions(-) create mode 100644 dist/operations/update.js diff --git a/dist/index.js b/dist/index.js index 98fdc4fe..7557a55a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -11,7 +11,7 @@ const processor = new processor_1.Processor(); operation: (_a = core.getInput("operation")) === null || _a === void 0 ? void 0 : _a.toLowerCase(), region: core.getInput("region"), table: core.getInput("table"), - // Get / Delete Operation + // Get / Delete / Update Operation key: helpers_1.forgivingJSONParse(core.getInput("key")), consistent: helpers_1.forgivingJSONParse(core.getInput("consistent")), // Put Operation diff --git a/dist/operations/index.js b/dist/operations/index.js index 2810ef89..af282a0a 100644 --- a/dist/operations/index.js +++ b/dist/operations/index.js @@ -7,7 +7,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); __exportStar(require("./base"), exports); @@ -15,3 +15,4 @@ __exportStar(require("./batch-put"), exports); __exportStar(require("./delete"), exports); __exportStar(require("./get"), exports); __exportStar(require("./put"), exports); +__exportStar(require("./update"), exports); diff --git a/dist/operations/update.js b/dist/operations/update.js new file mode 100644 index 00000000..38036db3 --- /dev/null +++ b/dist/operations/update.js @@ -0,0 +1,34 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.UpdateOperation = void 0; +const Joi = require("@hapi/joi"); +const helpers_1 = require("../helpers"); +const InputSchema = Joi.object({ + operation: Joi.string().lowercase().valid("update").required(), + region: Joi.string().lowercase().required(), + table: Joi.string().required(), + key: Joi.object().pattern(/./, Joi.alternatives().try(Joi.string(), Joi.number())).min(1).max(2).required(), + consistent: Joi.boolean().default(false).optional(), +}).required(); +class UpdateOperation { + constructor() { + this.name = "update"; + } + async validate(input) { + const validationResult = InputSchema.validate(input, { + stripUnknown: true, + }); + if (validationResult.error) { + throw validationResult.error; + } + return validationResult.value; + } + async execute(input) { + const ddb = helpers_1.createClient(input.region); + await ddb.update({ + TableName: input.table, + Key: input.key, + }).promise(); + } +} +exports.UpdateOperation = UpdateOperation; diff --git a/dist/processor.js b/dist/processor.js index f8ec2a32..61f950fd 100644 --- a/dist/processor.js +++ b/dist/processor.js @@ -9,6 +9,7 @@ class Processor { new operations_1.DeleteOperation(), new operations_1.GetOperation(), new operations_1.PutOperation(), + new operations_1.UpdateOperation() ]; } async process(input) { diff --git a/package-lock.json b/package-lock.json index e353802b..6670efbd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -308,6 +308,16 @@ "integrity": "sha512-VoNqai1vR5anRF5Tuh/+SWDFk7xi7oMwHrHrbm1BprYXjB2RJsWLhUrStMssDxEl5lW/z3EUdg8RvH/IUBccSQ==", "dev": true }, + "@dabh/diagnostics": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.2.tgz", + "integrity": "sha512-+A1YivoVDNNVCdfozHSR8v/jyuuLTMXwjWuxPFlFlUapXoGc+Gj9mDlTDDfrwl7rXCl2tNZ0kE8sIBO6YOn96Q==", + "requires": { + "colorspace": "1.1.x", + "enabled": "2.0.x", + "kuler": "^2.0.0" + } + }, "@hapi/address": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/@hapi/address/-/address-4.1.0.tgz", @@ -1056,6 +1066,11 @@ "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", "dev": true }, + "async": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.0.tgz", + "integrity": "sha512-TR2mEZFVOj2pLStYxLht7TyfuRzaydfpxr3k9RpHIzMgw7A64dzsdqCxH1WJyQdoe8T10nDXd9wnEigmiuHIZw==" + }, "at-least-node": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", @@ -1146,6 +1161,30 @@ "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", "dev": true }, + "build": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/build/-/build-0.1.4.tgz", + "integrity": "sha1-cH/gJv/O3crL/c3zVur9pk8VEEY=", + "requires": { + "cssmin": "0.3.x", + "jsmin": "1.x", + "jxLoader": "*", + "moo-server": "*", + "promised-io": "*", + "timespan": "2.x", + "uglify-js": "1.x", + "walker": "1.x", + "winston": "*", + "wrench": "1.3.x" + }, + "dependencies": { + "uglify-js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-1.3.5.tgz", + "integrity": "sha1-S1v/+Rhu/7qoiOTJ6UvZ/EyUkp0=" + } + } + }, "builtin-modules": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", @@ -1325,6 +1364,30 @@ "wrap-ansi": "^6.2.0" } }, + "color": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/color/-/color-3.0.0.tgz", + "integrity": "sha512-jCpd5+s0s0t7p3pHQKpnJ0TpQKKdleP71LWcA0aqiljpiuAkOSUFN/dyH8ZwF0hRmFlrIuRhufds1QyEP9EB+w==", + "requires": { + "color-convert": "^1.9.1", + "color-string": "^1.5.2" + }, + "dependencies": { + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + } + } + }, "color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -1337,8 +1400,16 @@ "color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "color-string": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.5.5.tgz", + "integrity": "sha512-jgIoum0OfQfq9Whcfc2z/VhCNcmQjWbey6qBX0vqt7YICflUmBCh9E9CiQD5GSJ+Uehixm3NUwHVhqUAWRivZg==", + "requires": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" + } }, "colors": { "version": "1.0.3", @@ -1346,6 +1417,15 @@ "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", "dev": true }, + "colorspace": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/colorspace/-/colorspace-1.1.2.tgz", + "integrity": "sha512-vt+OoIP2d76xLhjwbBaucYlNSpPsrJWPlBTtwCpQKIu6/CSMutyzX93O/Do0qzpH3YoHEes8YEFXyZ797rEhzQ==", + "requires": { + "color": "3.0.x", + "text-hex": "1.0.x" + } + }, "commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", @@ -1640,8 +1720,7 @@ "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, "cosmiconfig": { "version": "7.0.0", @@ -1684,6 +1763,11 @@ "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", "dev": true }, + "cssmin": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/cssmin/-/cssmin-0.3.2.tgz", + "integrity": "sha1-3c5MVHtRCuDVlKjx+/iq+OLFwA0=" + }, "cz-conventional-changelog": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/cz-conventional-changelog/-/cz-conventional-changelog-3.3.0.tgz", @@ -1933,6 +2017,11 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, + "enabled": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/enabled/-/enabled-2.0.0.tgz", + "integrity": "sha512-AKrN98kuwOzMIdAizXGI86UFBoo26CL21UM763y1h/GMSJ4/OHU9k2YlsmBpyScFo/wbLzWQJBMCW4+IO3/+OQ==" + }, "end-of-stream": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", @@ -2052,6 +2141,11 @@ "picomatch": "^2.2.1" } }, + "fast-safe-stringify": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz", + "integrity": "sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA==" + }, "fastq": { "version": "1.11.0", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.0.tgz", @@ -2061,6 +2155,11 @@ "reusify": "^1.0.4" } }, + "fecha": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.1.tgz", + "integrity": "sha512-MMMQ0ludy/nBs1/o0zVOiKTpG7qMbonKUzjJgQFEuvq6INZ1OraKPRAWkBq5vlKLOUMpmNYG1JoN3oDPUQ9m3Q==" + }, "figures": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", @@ -2110,6 +2209,11 @@ "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", "dev": true }, + "fn.name": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fn.name/-/fn.name-1.1.0.tgz", + "integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==" + }, "from2": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", @@ -2545,8 +2649,7 @@ "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "ini": { "version": "1.3.8", @@ -2771,8 +2874,7 @@ "is-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", - "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", - "dev": true + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==" }, "is-text-path": { "version": "1.0.1", @@ -2857,6 +2959,11 @@ "argparse": "^2.0.1" } }, + "jsmin": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/jsmin/-/jsmin-1.0.1.tgz", + "integrity": "sha1-570NzWSWw79IYyNb9GGj2YqjuYw=" + }, "json-parse-better-errors": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", @@ -2891,12 +2998,35 @@ "integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=", "dev": true }, + "jxLoader": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jxLoader/-/jxLoader-0.1.1.tgz", + "integrity": "sha1-ATTqUUTlM7WU/B/yX/GU4jXFPs0=", + "requires": { + "js-yaml": "0.3.x", + "moo-server": "1.3.x", + "promised-io": "*", + "walker": "1.x" + }, + "dependencies": { + "js-yaml": { + "version": "0.3.7", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-0.3.7.tgz", + "integrity": "sha1-1znY7oZGHlSzVNan19HyrZoWf2I=" + } + } + }, "kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", "dev": true }, + "kuler": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/kuler/-/kuler-2.0.0.tgz", + "integrity": "sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==" + }, "lines-and-columns": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", @@ -3005,6 +3135,25 @@ "chalk": "^4.0.0" } }, + "logform": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/logform/-/logform-2.2.0.tgz", + "integrity": "sha512-N0qPlqfypFx7UHNn4B3lzS/b0uLqt2hmuoa+PpuXNYgozdJYAyauF5Ky0BWVjrxDlMWiT3qN4zPq3vVAfZy7Yg==", + "requires": { + "colors": "^1.2.1", + "fast-safe-stringify": "^2.0.4", + "fecha": "^4.2.0", + "ms": "^2.1.1", + "triple-beam": "^1.3.0" + }, + "dependencies": { + "colors": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==" + } + } + }, "longest": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/longest/-/longest-2.0.1.tgz", @@ -3026,6 +3175,14 @@ "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", "dev": true }, + "makeerror": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz", + "integrity": "sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw=", + "requires": { + "tmpl": "1.0.x" + } + }, "map-obj": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.2.1.tgz", @@ -3362,11 +3519,15 @@ "integrity": "sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==", "dev": true }, + "moo-server": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/moo-server/-/moo-server-1.3.0.tgz", + "integrity": "sha1-XceVaVZaENbv7VQ5SR5p0jkuWPE=" + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "mute-stream": { "version": "0.0.7", @@ -5504,6 +5665,14 @@ "wrappy": "1" } }, + "one-time": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/one-time/-/one-time-1.0.0.tgz", + "integrity": "sha512-5DXOiRKwuSEcQ/l0kGCF6Q3jcADFv5tSmRaJck/OqkVFcOzutB134KRSfF0xDrL39MNnqxbHBbUUcjZIhTgb2g==", + "requires": { + "fn.name": "1.x.x" + } + }, "onetime": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", @@ -5788,8 +5957,12 @@ "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, + "promised-io": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/promised-io/-/promised-io-0.3.6.tgz", + "integrity": "sha512-bNwZusuNIW4m0SPR8jooSyndD35ggirHlxVl/UhIaZD/F0OBv9ebfc6tNmbpZts3QXHggkjIBH8lvtnzhtcz0A==" }, "pump": { "version": "3.0.0", @@ -5925,7 +6098,6 @@ "version": "3.6.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dev": true, "requires": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -6080,8 +6252,7 @@ "safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" }, "safer-buffer": { "version": "2.1.2", @@ -6362,6 +6533,21 @@ } } }, + "simple-swizzle": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", + "integrity": "sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=", + "requires": { + "is-arrayish": "^0.3.1" + }, + "dependencies": { + "is-arrayish": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", + "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==" + } + } + }, "slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -6454,6 +6640,11 @@ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, + "stack-trace": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", + "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=" + }, "stream-combiner2": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/stream-combiner2/-/stream-combiner2-1.1.1.tgz", @@ -6511,7 +6702,6 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dev": true, "requires": { "safe-buffer": "~5.2.0" } @@ -6604,6 +6794,11 @@ "integrity": "sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ==", "dev": true }, + "text-hex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/text-hex/-/text-hex-1.0.0.tgz", + "integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==" + }, "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -6619,6 +6814,11 @@ "readable-stream": "3" } }, + "timespan": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/timespan/-/timespan-2.3.0.tgz", + "integrity": "sha1-SQLOBAvRPYRcj1myfp1ZutbzmSk=" + }, "tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", @@ -6628,6 +6828,11 @@ "os-tmpdir": "~1.0.2" } }, + "tmpl": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", + "integrity": "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=" + }, "to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -6655,6 +6860,11 @@ "integrity": "sha1-n5up2e+odkw4dpi8v+sshI8RrbM=", "dev": true }, + "triple-beam": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.3.0.tgz", + "integrity": "sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw==" + }, "ts-node": { "version": "8.10.2", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.10.2.tgz", @@ -6676,6 +6886,11 @@ } } }, + "tsc": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/tsc/-/tsc-2.0.3.tgz", + "integrity": "sha512-SN+9zBUtrpUcOpaUO7GjkEHgWtf22c7FKbKCA4e858eEM7Qz86rRDpgOU2lBIDf0fLCsEg65ms899UMUIB2+Ow==" + }, "tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", @@ -6859,8 +7074,7 @@ "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, "uuid": { "version": "3.3.2", @@ -6877,6 +7091,14 @@ "spdx-expression-parse": "^3.0.0" } }, + "walker": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.7.tgz", + "integrity": "sha1-L3+bj9ENZ3JisYqITijRlhjgKPs=", + "requires": { + "makeerror": "1.0.x" + } + }, "which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", @@ -6940,6 +7162,60 @@ } } }, + "winston": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/winston/-/winston-3.3.3.tgz", + "integrity": "sha512-oEXTISQnC8VlSAKf1KYSSd7J6IWuRPQqDdo8eoRNaYKLvwSb5+79Z3Yi1lrl6KDpU6/VWaxpakDAtb1oQ4n9aw==", + "requires": { + "@dabh/diagnostics": "^2.0.2", + "async": "^3.1.0", + "is-stream": "^2.0.0", + "logform": "^2.2.0", + "one-time": "^1.0.0", + "readable-stream": "^3.4.0", + "stack-trace": "0.0.x", + "triple-beam": "^1.3.0", + "winston-transport": "^4.4.0" + } + }, + "winston-transport": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/winston-transport/-/winston-transport-4.4.0.tgz", + "integrity": "sha512-Lc7/p3GtqtqPBYYtS6KCN3c77/2QCev51DvcJKbkFPQNoj1sinkGwLGFDxkXY9J6p9+EPnYs+D90uwbnaiURTw==", + "requires": { + "readable-stream": "^2.3.7", + "triple-beam": "^1.2.0" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, "word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", @@ -6975,6 +7251,11 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, + "wrench": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/wrench/-/wrench-1.3.9.tgz", + "integrity": "sha1-bxPsNRRTF+spLKX2UxORskQRFBE=" + }, "xml2js": { "version": "0.4.19", "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", diff --git a/package.json b/package.json index 73040128..da4a4a58 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,9 @@ "@actions/glob": "^0.2.0", "@hapi/joi": "^17.1.1", "aws-sdk": "^2.703.0", - "joi": "^17.4.0" + "build": "^0.1.4", + "joi": "^17.4.0", + "tsc": "^2.0.3" }, "config": { "commitizen": { From 5333cea16a5987048a51db07eb362ff958ef366f Mon Sep 17 00:00:00 2001 From: rkathir-solink Date: Tue, 22 Jun 2021 09:21:12 -0400 Subject: [PATCH 13/41] update.ts bug fixes --- src/operations/update.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/operations/update.ts b/src/operations/update.ts index ba3310db..c462e659 100644 --- a/src/operations/update.ts +++ b/src/operations/update.ts @@ -7,15 +7,13 @@ const InputSchema = Joi.object({ region: Joi.string().lowercase().required(), table: Joi.string().required(), key: Joi.object().pattern(/./, Joi.alternatives().try(Joi.string(), Joi.number())).min(1).max(2).required(), - consistent: Joi.boolean().default(false).optional(), }).required(); -interface UpdateOperationInput { +export interface UpdateOperationInput { operation: "update"; region: string; table: string; key: { [key: string]: string | number }; - consistent: boolean; } export class UpdateOperation implements Operation { From 101dd904cd8ad1c27169832d75b9da94fb542484 Mon Sep 17 00:00:00 2001 From: rkathir-solink Date: Tue, 22 Jun 2021 10:42:52 -0400 Subject: [PATCH 14/41] view input operations --- src/processor.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/processor.ts b/src/processor.ts index b5a6115f..dbc913a1 100644 --- a/src/processor.ts +++ b/src/processor.ts @@ -15,6 +15,7 @@ export class Processor { operation: string; [key: string]: unknown; }): Promise { + console.log(this.operations); for (const operation of this.operations) { if (operation.name === input.operation) { const validated = await operation.validate(input); From 762055d98a1b481df06b0042283396da0d8c103d Mon Sep 17 00:00:00 2001 From: rkathir-solink Date: Tue, 22 Jun 2021 13:02:41 -0400 Subject: [PATCH 15/41] replace deprecated dependency @hapi/joi with joi --- dist/operations/batch-put.js | 2 +- dist/operations/delete.js | 2 +- dist/operations/get.js | 2 +- dist/operations/put.js | 2 +- dist/operations/update.js | 2 +- package-lock.json | 36 +++--------------------------------- package.json | 1 - src/operations/batch-put.ts | 2 +- src/operations/delete.ts | 2 +- src/operations/get.ts | 2 +- src/operations/put.ts | 2 +- src/operations/update.ts | 2 +- 12 files changed, 13 insertions(+), 44 deletions(-) diff --git a/dist/operations/batch-put.js b/dist/operations/batch-put.js index 088c4318..c9c9f993 100644 --- a/dist/operations/batch-put.js +++ b/dist/operations/batch-put.js @@ -2,7 +2,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.BatchPutOperation = void 0; const glob = require("@actions/glob"); -const Joi = require("@hapi/joi"); +const Joi = require("joi"); const fs_1 = require("fs"); const helpers_1 = require("../helpers"); const BaseInputSchema = Joi.object({ diff --git a/dist/operations/delete.js b/dist/operations/delete.js index de9ad447..09d3b9ae 100644 --- a/dist/operations/delete.js +++ b/dist/operations/delete.js @@ -1,7 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DeleteOperation = void 0; -const Joi = require("@hapi/joi"); +const Joi = require("joi"); const helpers_1 = require("../helpers"); const InputSchema = Joi.object({ operation: Joi.string().lowercase().valid("delete").required(), diff --git a/dist/operations/get.js b/dist/operations/get.js index e176d07d..c544cd55 100644 --- a/dist/operations/get.js +++ b/dist/operations/get.js @@ -1,7 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GetOperation = void 0; -const Joi = require("@hapi/joi"); +const Joi = require("joi"); const helpers_1 = require("../helpers"); const InputSchema = Joi.object({ operation: Joi.string().lowercase().valid("get").required(), diff --git a/dist/operations/put.js b/dist/operations/put.js index 6c7cabd2..15f2fa92 100644 --- a/dist/operations/put.js +++ b/dist/operations/put.js @@ -1,7 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PutOperation = void 0; -const Joi = require("@hapi/joi"); +const Joi = require("joi"); const fs_1 = require("fs"); const helpers_1 = require("../helpers"); const BaseInputSchema = Joi.object({ diff --git a/dist/operations/update.js b/dist/operations/update.js index 38036db3..2bc0fdf4 100644 --- a/dist/operations/update.js +++ b/dist/operations/update.js @@ -1,7 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.UpdateOperation = void 0; -const Joi = require("@hapi/joi"); +const Joi = require("joi"); const helpers_1 = require("../helpers"); const InputSchema = Joi.object({ operation: Joi.string().lowercase().valid("update").required(), diff --git a/package-lock.json b/package-lock.json index 6670efbd..269b2558 100644 --- a/package-lock.json +++ b/package-lock.json @@ -318,40 +318,10 @@ "kuler": "^2.0.0" } }, - "@hapi/address": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@hapi/address/-/address-4.1.0.tgz", - "integrity": "sha512-SkszZf13HVgGmChdHo/PxchnSaCJ6cetVqLzyciudzZRT0jcOouIF/Q93mgjw8cce+D+4F4C1Z/WrfFN+O3VHQ==", - "requires": { - "@hapi/hoek": "^9.0.0" - } - }, - "@hapi/formula": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@hapi/formula/-/formula-2.0.0.tgz", - "integrity": "sha512-V87P8fv7PI0LH7LiVi8Lkf3x+KCO7pQozXRssAHNXXL9L1K+uyu4XypLXwxqVDKgyQai6qj3/KteNlrqDx4W5A==" - }, "@hapi/hoek": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.1.1.tgz", - "integrity": "sha512-CAEbWH7OIur6jEOzaai83jq3FmKmv4PmX1JYfs9IrYcGEVI/lyL1EXJGCj7eFVJ0bg5QR8LMxBlEtA+xKiLpFw==" - }, - "@hapi/joi": { - "version": "17.1.1", - "resolved": "https://registry.npmjs.org/@hapi/joi/-/joi-17.1.1.tgz", - "integrity": "sha512-p4DKeZAoeZW4g3u7ZeRo+vCDuSDgSvtsB/NpfjXEHTUjSeINAi/RrVOWiVQ1isaoLzMvFEhe8n5065mQq1AdQg==", - "requires": { - "@hapi/address": "^4.0.1", - "@hapi/formula": "^2.0.0", - "@hapi/hoek": "^9.0.0", - "@hapi/pinpoint": "^2.0.0", - "@hapi/topo": "^5.0.0" - } - }, - "@hapi/pinpoint": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@hapi/pinpoint/-/pinpoint-2.0.0.tgz", - "integrity": "sha512-vzXR5MY7n4XeIvLpfl3HtE3coZYO4raKXW766R6DZw/6aLqR26iuZ109K7a0NtF2Db0jxqh7xz2AxkUwpUFybw==" + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.0.tgz", + "integrity": "sha512-sqKVVVOe5ivCaXDWivIJYVSaEgdQK9ul7a4Kity5Iw7u9+wBAPbX1RMSnLLmp7O4Vzj0WOWwMAJsTL00xwaNug==" }, "@hapi/topo": { "version": "5.0.0", diff --git a/package.json b/package.json index da4a4a58..ff53a3e7 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,6 @@ "dependencies": { "@actions/core": "^1.2.6", "@actions/glob": "^0.2.0", - "@hapi/joi": "^17.1.1", "aws-sdk": "^2.703.0", "build": "^0.1.4", "joi": "^17.4.0", diff --git a/src/operations/batch-put.ts b/src/operations/batch-put.ts index 217bac4d..557e086b 100644 --- a/src/operations/batch-put.ts +++ b/src/operations/batch-put.ts @@ -1,5 +1,5 @@ import * as glob from "@actions/glob"; -import * as Joi from "@hapi/joi"; +import * as Joi from "joi"; import { promises as fs } from "fs"; import { createClient } from "../helpers"; import { Operation } from "./base"; diff --git a/src/operations/delete.ts b/src/operations/delete.ts index fb162f6c..7258a2bd 100644 --- a/src/operations/delete.ts +++ b/src/operations/delete.ts @@ -1,4 +1,4 @@ -import * as Joi from "@hapi/joi"; +import * as Joi from "joi"; import { createClient } from "../helpers"; import { Operation } from "./base"; diff --git a/src/operations/get.ts b/src/operations/get.ts index eec96bf0..ede7185d 100644 --- a/src/operations/get.ts +++ b/src/operations/get.ts @@ -1,4 +1,4 @@ -import * as Joi from "@hapi/joi"; +import * as Joi from "joi"; import { createClient } from "../helpers"; import { Operation } from "./base"; diff --git a/src/operations/put.ts b/src/operations/put.ts index d044ebc3..3dbd2bbc 100644 --- a/src/operations/put.ts +++ b/src/operations/put.ts @@ -1,4 +1,4 @@ -import * as Joi from "@hapi/joi"; +import * as Joi from "joi"; import { promises as fs } from "fs"; import { createClient } from "../helpers"; import { Operation } from "./base"; diff --git a/src/operations/update.ts b/src/operations/update.ts index c462e659..934cd883 100644 --- a/src/operations/update.ts +++ b/src/operations/update.ts @@ -1,4 +1,4 @@ -import * as Joi from "@hapi/joi"; +import * as Joi from "joi"; import { createClient } from "../helpers"; import { Operation } from "./base"; From c1edbfffdb90dd17395f9a5e855fecee918211fb Mon Sep 17 00:00:00 2001 From: rkathir-solink Date: Tue, 22 Jun 2021 13:20:39 -0400 Subject: [PATCH 16/41] initial commit --- src/operations/update.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/operations/update.ts b/src/operations/update.ts index 934cd883..fed4e24d 100644 --- a/src/operations/update.ts +++ b/src/operations/update.ts @@ -1,6 +1,6 @@ import * as Joi from "joi"; import { createClient } from "../helpers"; -import { Operation } from "./base"; +import { Operation } from "./base"; const InputSchema = Joi.object({ operation: Joi.string().lowercase().valid("update").required(), From fe6f0cc1f1ebac0b54d444ed2481f1c64a6bab72 Mon Sep 17 00:00:00 2001 From: rkathir-solink Date: Tue, 22 Jun 2021 13:25:15 -0400 Subject: [PATCH 17/41] revert console log --- src/processor.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/processor.ts b/src/processor.ts index dbc913a1..b5a6115f 100644 --- a/src/processor.ts +++ b/src/processor.ts @@ -15,7 +15,6 @@ export class Processor { operation: string; [key: string]: unknown; }): Promise { - console.log(this.operations); for (const operation of this.operations) { if (operation.name === input.operation) { const validated = await operation.validate(input); From f2dd467dfd592f98ae026e28b268fe1ee0cb5ac7 Mon Sep 17 00:00:00 2001 From: rkathir-solink Date: Tue, 22 Jun 2021 14:49:00 -0400 Subject: [PATCH 18/41] include update data parameters --- dist/index.js | 3 +++ dist/operations/update.js | 5 ++++- src/index.ts | 4 ++++ src/operations/update.ts | 7 +++++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/dist/index.js b/dist/index.js index 7557a55a..459c7832 100644 --- a/dist/index.js +++ b/dist/index.js @@ -20,6 +20,9 @@ const processor = new processor_1.Processor(); // BatchPut Operation items: helpers_1.forgivingJSONParse(core.getInput("items")), files: core.getInput("files"), + // Update Operation + updateExpression: helpers_1.forgivingJSONParse(core.getInput("updateExpression")), + expressionAttributeValues: helpers_1.forgivingJSONParse(core.getInput("expressionAttributeValues")) }; const output = await processor.process(input); if (output) { diff --git a/dist/operations/update.js b/dist/operations/update.js index 2bc0fdf4..c5d403c3 100644 --- a/dist/operations/update.js +++ b/dist/operations/update.js @@ -8,7 +8,8 @@ const InputSchema = Joi.object({ region: Joi.string().lowercase().required(), table: Joi.string().required(), key: Joi.object().pattern(/./, Joi.alternatives().try(Joi.string(), Joi.number())).min(1).max(2).required(), - consistent: Joi.boolean().default(false).optional(), + updateExpression: Joi.string().required(), + expressionAttributeValues: Joi.string().required() }).required(); class UpdateOperation { constructor() { @@ -28,6 +29,8 @@ class UpdateOperation { await ddb.update({ TableName: input.table, Key: input.key, + UpdateExpression: input.updateExpression, + ExpressionAttributeValues: input.expressionAttributeValues }).promise(); } } diff --git a/src/index.ts b/src/index.ts index 6a58ba01..e6888eb4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -23,6 +23,10 @@ const processor = new Processor(); // BatchPut Operation items: forgivingJSONParse(core.getInput("items")), files: core.getInput("files"), + + // Update Operation + updateExpression: forgivingJSONParse(core.getInput("updateExpression")), + expressionAttributeValues: forgivingJSONParse(core.getInput("expressionAttributeValues")) }; const output = await processor.process(input); diff --git a/src/operations/update.ts b/src/operations/update.ts index fed4e24d..3feb9631 100644 --- a/src/operations/update.ts +++ b/src/operations/update.ts @@ -1,4 +1,5 @@ import * as Joi from "joi"; +import { string } from "joi"; import { createClient } from "../helpers"; import { Operation } from "./base"; @@ -7,6 +8,8 @@ const InputSchema = Joi.object({ region: Joi.string().lowercase().required(), table: Joi.string().required(), key: Joi.object().pattern(/./, Joi.alternatives().try(Joi.string(), Joi.number())).min(1).max(2).required(), + updateExpression: Joi.string().required(), + expressionAttributeValues: Joi.string().required() }).required(); export interface UpdateOperationInput { @@ -14,6 +17,8 @@ export interface UpdateOperationInput { region: string; table: string; key: { [key: string]: string | number }; + updateExpression: string; + expressionAttributeValues: { [key: string]: string }; } export class UpdateOperation implements Operation { @@ -35,6 +40,8 @@ export class UpdateOperation implements Operation { await ddb.update({ TableName: input.table, Key: input.key, + UpdateExpression: input.updateExpression, + ExpressionAttributeValues: input.expressionAttributeValues }).promise(); } } From d2bcbef7973741ad0b54eb2cb1d192d09d996b6b Mon Sep 17 00:00:00 2001 From: rkathir-solink Date: Tue, 22 Jun 2021 15:29:51 -0400 Subject: [PATCH 19/41] update details for update operation --- action.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/action.yml b/action.yml index 83c0e249..f94b4dd6 100644 --- a/action.yml +++ b/action.yml @@ -36,6 +36,14 @@ inputs: description: 'Item Value, Only required for batch-put operation' required: false + #Update Operation + updateExpression: + description: 'Attribute variables, Only required for update operation' + required: false + expressionAttributeValues: + description: 'Attribute values to be updated, Only required for update operation' + required: false + outputs: item: description: 'JSON-serialized Item' From e280d6bc779380364a068ee32a02df02317bd2f9 Mon Sep 17 00:00:00 2001 From: rkathir-solink Date: Tue, 22 Jun 2021 17:26:53 -0400 Subject: [PATCH 20/41] reorder inputs --- src/operations/update.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/operations/update.ts b/src/operations/update.ts index 3feb9631..c73e0eff 100644 --- a/src/operations/update.ts +++ b/src/operations/update.ts @@ -7,18 +7,18 @@ const InputSchema = Joi.object({ operation: Joi.string().lowercase().valid("update").required(), region: Joi.string().lowercase().required(), table: Joi.string().required(), - key: Joi.object().pattern(/./, Joi.alternatives().try(Joi.string(), Joi.number())).min(1).max(2).required(), updateExpression: Joi.string().required(), - expressionAttributeValues: Joi.string().required() + expressionAttributeValues: Joi.string().required(), + key: Joi.object().pattern(/./, Joi.alternatives().try(Joi.string(), Joi.number())).min(1).max(2).required(), }).required(); export interface UpdateOperationInput { operation: "update"; region: string; table: string; - key: { [key: string]: string | number }; updateExpression: string; expressionAttributeValues: { [key: string]: string }; + key: { [key: string]: string | number }; } export class UpdateOperation implements Operation { From 55d89d891e046c3e260598c59cc4266c76129cc3 Mon Sep 17 00:00:00 2001 From: rkathir-solink Date: Tue, 22 Jun 2021 18:16:06 -0400 Subject: [PATCH 21/41] change format of expressions accepted --- src/operations/update.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/operations/update.ts b/src/operations/update.ts index c73e0eff..57c9ed5c 100644 --- a/src/operations/update.ts +++ b/src/operations/update.ts @@ -17,7 +17,7 @@ export interface UpdateOperationInput { region: string; table: string; updateExpression: string; - expressionAttributeValues: { [key: string]: string }; + expressionAttributeValues: string; key: { [key: string]: string | number }; } @@ -40,8 +40,10 @@ export class UpdateOperation implements Operation { await ddb.update({ TableName: input.table, Key: input.key, - UpdateExpression: input.updateExpression, - ExpressionAttributeValues: input.expressionAttributeValues + UpdateExpression: `set ${input.updateExpression} = :${input.updateExpression}`, + ExpressionAttributeValues: { + [`:${input.updateExpression}`]:`${input.expressionAttributeValues}` + } }).promise(); } } From 1796093d12bd1ddb5dd84ff8243f97b44572fa9a Mon Sep 17 00:00:00 2001 From: rkathir-solink Date: Wed, 23 Jun 2021 09:12:08 -0400 Subject: [PATCH 22/41] take expression attribute as env variable --- src/operations/update.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/operations/update.ts b/src/operations/update.ts index 57c9ed5c..15c1908a 100644 --- a/src/operations/update.ts +++ b/src/operations/update.ts @@ -42,7 +42,7 @@ export class UpdateOperation implements Operation { Key: input.key, UpdateExpression: `set ${input.updateExpression} = :${input.updateExpression}`, ExpressionAttributeValues: { - [`:${input.updateExpression}`]:`${input.expressionAttributeValues}` + [`:${input.updateExpression}`]:`${process.env.expressionAttributeValues}` } }).promise(); } From 4d57f6b00b33ed479332645bbd325ae1f7f7830e Mon Sep 17 00:00:00 2001 From: rkathir-solink Date: Wed, 23 Jun 2021 09:28:59 -0400 Subject: [PATCH 23/41] revert env variable usage --- src/operations/update.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/operations/update.ts b/src/operations/update.ts index 15c1908a..57c9ed5c 100644 --- a/src/operations/update.ts +++ b/src/operations/update.ts @@ -42,7 +42,7 @@ export class UpdateOperation implements Operation { Key: input.key, UpdateExpression: `set ${input.updateExpression} = :${input.updateExpression}`, ExpressionAttributeValues: { - [`:${input.updateExpression}`]:`${process.env.expressionAttributeValues}` + [`:${input.updateExpression}`]:`${input.expressionAttributeValues}` } }).promise(); } From bdcb7e13ada0dd77ad68dc3323fc0e6a083997d2 Mon Sep 17 00:00:00 2001 From: rkathir-solink Date: Wed, 23 Jun 2021 11:39:27 -0400 Subject: [PATCH 24/41] remove forgivingJSONparse on new parameters + tsc --- dist/index.js | 4 ++-- dist/operations/update.js | 10 ++++++---- src/index.ts | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/dist/index.js b/dist/index.js index 459c7832..7c47a0b9 100644 --- a/dist/index.js +++ b/dist/index.js @@ -21,8 +21,8 @@ const processor = new processor_1.Processor(); items: helpers_1.forgivingJSONParse(core.getInput("items")), files: core.getInput("files"), // Update Operation - updateExpression: helpers_1.forgivingJSONParse(core.getInput("updateExpression")), - expressionAttributeValues: helpers_1.forgivingJSONParse(core.getInput("expressionAttributeValues")) + updateExpression: core.getInput("updateExpression"), + expressionAttributeValues: core.getInput("expressionAttributeValues") }; const output = await processor.process(input); if (output) { diff --git a/dist/operations/update.js b/dist/operations/update.js index c5d403c3..259d4598 100644 --- a/dist/operations/update.js +++ b/dist/operations/update.js @@ -7,9 +7,9 @@ const InputSchema = Joi.object({ operation: Joi.string().lowercase().valid("update").required(), region: Joi.string().lowercase().required(), table: Joi.string().required(), - key: Joi.object().pattern(/./, Joi.alternatives().try(Joi.string(), Joi.number())).min(1).max(2).required(), updateExpression: Joi.string().required(), - expressionAttributeValues: Joi.string().required() + expressionAttributeValues: Joi.string().required(), + key: Joi.object().pattern(/./, Joi.alternatives().try(Joi.string(), Joi.number())).min(1).max(2).required(), }).required(); class UpdateOperation { constructor() { @@ -29,8 +29,10 @@ class UpdateOperation { await ddb.update({ TableName: input.table, Key: input.key, - UpdateExpression: input.updateExpression, - ExpressionAttributeValues: input.expressionAttributeValues + UpdateExpression: `set ${input.updateExpression} = :${input.updateExpression}`, + ExpressionAttributeValues: { + [`:${input.updateExpression}`]: `${input.expressionAttributeValues}` + } }).promise(); } } diff --git a/src/index.ts b/src/index.ts index e6888eb4..4c53cb5c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -25,8 +25,8 @@ const processor = new Processor(); files: core.getInput("files"), // Update Operation - updateExpression: forgivingJSONParse(core.getInput("updateExpression")), - expressionAttributeValues: forgivingJSONParse(core.getInput("expressionAttributeValues")) + updateExpression: core.getInput("updateExpression"), + expressionAttributeValues: core.getInput("expressionAttributeValues") }; const output = await processor.process(input); From 388ebf49546ff6f240e30f9b24dbaf0f55892eb5 Mon Sep 17 00:00:00 2001 From: rkathir-solink Date: Thu, 24 Jun 2021 10:06:15 -0400 Subject: [PATCH 25/41] implement ability to read file as input --- dist/operations/update.js | 27 +++++++++++++++----- package-lock.json | 52 +++++++++++++++++++++++++++++++-------- package.json | 2 ++ src/operations/update.ts | 45 +++++++++++++++++++++++++-------- 4 files changed, 100 insertions(+), 26 deletions(-) diff --git a/dist/operations/update.js b/dist/operations/update.js index 259d4598..da91ef00 100644 --- a/dist/operations/update.js +++ b/dist/operations/update.js @@ -2,15 +2,25 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.UpdateOperation = void 0; const Joi = require("joi"); +const fs = require("fs-extra"); const helpers_1 = require("../helpers"); -const InputSchema = Joi.object({ +const BaseInputSchema = Joi.object({ operation: Joi.string().lowercase().valid("update").required(), region: Joi.string().lowercase().required(), table: Joi.string().required(), - updateExpression: Joi.string().required(), - expressionAttributeValues: Joi.string().required(), - key: Joi.object().pattern(/./, Joi.alternatives().try(Joi.string(), Joi.number())).min(1).max(2).required(), -}).required(); +}); +const InputSchema = Joi.alternatives([ + BaseInputSchema.append({ + updateExpression: Joi.string().required(), + expressionAttributeValues: Joi.string().required(), + key: Joi.object().required(), + }), + BaseInputSchema.append({ + updateExpression: Joi.string().required(), + expressionAttributeValues: Joi.string().required(), + file: Joi.string().required(), + }), +]).required(); class UpdateOperation { constructor() { this.name = "update"; @@ -26,14 +36,19 @@ class UpdateOperation { } async execute(input) { const ddb = helpers_1.createClient(input.region); + const item = input.key || await this.read(input.file); await ddb.update({ TableName: input.table, - Key: input.key, + Key: item, UpdateExpression: `set ${input.updateExpression} = :${input.updateExpression}`, ExpressionAttributeValues: { [`:${input.updateExpression}`]: `${input.expressionAttributeValues}` } }).promise(); } + async read(path) { + const content = await fs.readFile(path, { encoding: "utf8" }); + return JSON.parse(content); + } } exports.UpdateOperation = UpdateOperation; diff --git a/package-lock.json b/package-lock.json index 269b2558..4c207bd2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -222,6 +222,20 @@ "@commitlint/top-level": "^11.0.0", "fs-extra": "^9.0.0", "git-raw-commits": "^2.0.0" + }, + "dependencies": { + "fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "requires": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + } } }, "@commitlint/resolve-extends": { @@ -507,6 +521,20 @@ "aggregate-error": "^3.0.0", "fs-extra": "^9.0.0", "lodash": "^4.17.4" + }, + "dependencies": { + "fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "requires": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + } } }, "@semantic-release/commit-analyzer": { @@ -868,6 +896,15 @@ "integrity": "sha512-rS27+EkB/RE1Iz3u0XtVL5q36MGDWbgYe7zWiodyKNUnthxY0rukK5V36eiUCtCisB7NN8zKYH6DO2M37qxFEQ==", "dev": true }, + "@types/fs-extra": { + "version": "9.0.11", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.11.tgz", + "integrity": "sha512-mZsifGG4QeQ7hlkhO56u7zt/ycBgGxSVsFI/6lGTU34VtwkiqrrSDgw0+ygs8kFGWcXnFQWMrzF2h7TtDFNixA==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "@types/hapi__joi": { "version": "17.1.6", "resolved": "https://registry.npmjs.org/@types/hapi__joi/-/hapi__joi-17.1.6.tgz", @@ -2227,12 +2264,10 @@ } }, "fs-extra": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", - "dev": true, + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz", + "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==", "requires": { - "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" @@ -2435,8 +2470,7 @@ "graceful-fs": { "version": "4.2.6", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", - "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==", - "dev": true + "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==" }, "growl": { "version": "1.10.5", @@ -2956,7 +2990,6 @@ "version": "6.1.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "dev": true, "requires": { "graceful-fs": "^4.1.6", "universalify": "^2.0.0" @@ -7023,8 +7056,7 @@ "universalify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", - "dev": true + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==" }, "url": { "version": "0.10.3", diff --git a/package.json b/package.json index ff53a3e7..e86c9a2e 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "@semantic-release/git": "9.0.0", "@semantic-release/release-notes-generator": "9.0.3", "@types/chai": "4.2.18", + "@types/fs-extra": "^9.0.11", "@types/hapi__joi": "17.1.6", "@types/joi": "14.3.4", "@types/mocha": "8.2.2", @@ -51,6 +52,7 @@ "@actions/glob": "^0.2.0", "aws-sdk": "^2.703.0", "build": "^0.1.4", + "fs-extra": "^10.0.0", "joi": "^17.4.0", "tsc": "^2.0.3" }, diff --git a/src/operations/update.ts b/src/operations/update.ts index 57c9ed5c..2f819665 100644 --- a/src/operations/update.ts +++ b/src/operations/update.ts @@ -1,25 +1,42 @@ import * as Joi from "joi"; -import { string } from "joi"; +import * as fs from "fs-extra"; import { createClient } from "../helpers"; import { Operation } from "./base"; -const InputSchema = Joi.object({ +const BaseInputSchema = Joi.object({ operation: Joi.string().lowercase().valid("update").required(), region: Joi.string().lowercase().required(), table: Joi.string().required(), - updateExpression: Joi.string().required(), - expressionAttributeValues: Joi.string().required(), - key: Joi.object().pattern(/./, Joi.alternatives().try(Joi.string(), Joi.number())).min(1).max(2).required(), -}).required(); +}); -export interface UpdateOperationInput { +const InputSchema = Joi.alternatives([ + BaseInputSchema.append({ + updateExpression: Joi.string().required(), + expressionAttributeValues: Joi.string().required(), + key: Joi.object().required(), + }), + BaseInputSchema.append({ + updateExpression: Joi.string().required(), + expressionAttributeValues: Joi.string().required(), + file: Joi.string().required(), + }), +]).required(); + +export type UpdateOperationInput = { operation: "update"; region: string; table: string; +} & ({ updateExpression: string; expressionAttributeValues: string; - key: { [key: string]: string | number }; -} + key: { [key: string]: any }; + file?: never; +} | { + updateExpression: string; + expressionAttributeValues: string; + key?: never; + file: string; +}); export class UpdateOperation implements Operation { public readonly name = "update"; @@ -37,13 +54,21 @@ export class UpdateOperation implements Operation { public async execute(input: UpdateOperationInput) { const ddb = createClient(input.region); + const item = input.key || await this.read(input.file); + await ddb.update({ TableName: input.table, - Key: input.key, + Key: item, UpdateExpression: `set ${input.updateExpression} = :${input.updateExpression}`, ExpressionAttributeValues: { [`:${input.updateExpression}`]:`${input.expressionAttributeValues}` } }).promise(); } + + private async read(path: string) { + const content = await fs.readFile(path, { encoding: "utf8" }); + + return JSON.parse(content); + } } From 24e7ea6fb0c2a1838937b6e45c8356553f1278bc Mon Sep 17 00:00:00 2001 From: rkathir-solink Date: Thu, 24 Jun 2021 10:26:54 -0400 Subject: [PATCH 26/41] take file as input for expression values --- src/operations/update.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/operations/update.ts b/src/operations/update.ts index 2f819665..187976ae 100644 --- a/src/operations/update.ts +++ b/src/operations/update.ts @@ -17,8 +17,8 @@ const InputSchema = Joi.alternatives([ }), BaseInputSchema.append({ updateExpression: Joi.string().required(), - expressionAttributeValues: Joi.string().required(), - file: Joi.string().required(), + expressionAttributeFiles: Joi.string().required(), + key: Joi.string().required(), }), ]).required(); @@ -29,13 +29,13 @@ export type UpdateOperationInput = { } & ({ updateExpression: string; expressionAttributeValues: string; + expressionAttributeFiles?: never; key: { [key: string]: any }; - file?: never; } | { updateExpression: string; - expressionAttributeValues: string; - key?: never; - file: string; + expressionAttributeValues?: never; + expressionAttributeFiles: string; + key: { [key: string]: any }; }); export class UpdateOperation implements Operation { @@ -54,14 +54,14 @@ export class UpdateOperation implements Operation { public async execute(input: UpdateOperationInput) { const ddb = createClient(input.region); - const item = input.key || await this.read(input.file); + const item = input.key || await this.read(input.expressionAttributeFiles!); await ddb.update({ TableName: input.table, - Key: item, + Key: input.key, UpdateExpression: `set ${input.updateExpression} = :${input.updateExpression}`, ExpressionAttributeValues: { - [`:${input.updateExpression}`]:`${input.expressionAttributeValues}` + [`:${input.updateExpression}`]:`${item}` } }).promise(); } From 3538ab536e5fec446c37393ca44d510510e04783 Mon Sep 17 00:00:00 2001 From: rkathir-solink Date: Thu, 24 Jun 2021 11:00:38 -0400 Subject: [PATCH 27/41] include files in accepted inputs --- dist/index.js | 3 ++- dist/operations/update.js | 10 +++++----- src/index.ts | 3 ++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/dist/index.js b/dist/index.js index 7c47a0b9..be688768 100644 --- a/dist/index.js +++ b/dist/index.js @@ -22,7 +22,8 @@ const processor = new processor_1.Processor(); files: core.getInput("files"), // Update Operation updateExpression: core.getInput("updateExpression"), - expressionAttributeValues: core.getInput("expressionAttributeValues") + expressionAttributeValues: core.getInput("expressionAttributeValues"), + expressionAttributeFiles: core.getInput("expressionAttributeFiles") }; const output = await processor.process(input); if (output) { diff --git a/dist/operations/update.js b/dist/operations/update.js index da91ef00..c7523306 100644 --- a/dist/operations/update.js +++ b/dist/operations/update.js @@ -17,8 +17,8 @@ const InputSchema = Joi.alternatives([ }), BaseInputSchema.append({ updateExpression: Joi.string().required(), - expressionAttributeValues: Joi.string().required(), - file: Joi.string().required(), + expressionAttributeFiles: Joi.string().required(), + key: Joi.string().required(), }), ]).required(); class UpdateOperation { @@ -36,13 +36,13 @@ class UpdateOperation { } async execute(input) { const ddb = helpers_1.createClient(input.region); - const item = input.key || await this.read(input.file); + const item = input.key || await this.read(input.expressionAttributeFiles); await ddb.update({ TableName: input.table, - Key: item, + Key: input.key, UpdateExpression: `set ${input.updateExpression} = :${input.updateExpression}`, ExpressionAttributeValues: { - [`:${input.updateExpression}`]: `${input.expressionAttributeValues}` + [`:${input.updateExpression}`]: `${item}` } }).promise(); } diff --git a/src/index.ts b/src/index.ts index 4c53cb5c..c5688405 100644 --- a/src/index.ts +++ b/src/index.ts @@ -26,7 +26,8 @@ const processor = new Processor(); // Update Operation updateExpression: core.getInput("updateExpression"), - expressionAttributeValues: core.getInput("expressionAttributeValues") + expressionAttributeValues: core.getInput("expressionAttributeValues"), + expressionAttributeFiles: core.getInput("expressionAttributeFiles") }; const output = await processor.process(input); From 9468519ef9426bda7717e1baa7baf3b27c82e4bd Mon Sep 17 00:00:00 2001 From: rkathir-solink Date: Thu, 24 Jun 2021 11:13:27 -0400 Subject: [PATCH 28/41] include files option in action.yml --- action.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/action.yml b/action.yml index f94b4dd6..419f23c2 100644 --- a/action.yml +++ b/action.yml @@ -43,6 +43,9 @@ inputs: expressionAttributeValues: description: 'Attribute values to be updated, Only required for update operation' required: false + expressionAttributeFiles: + description: 'Attribute values to be updated, Only required for update operation' + required: false outputs: item: From d19a83bc7d57a5d9102beadb40317dedc3490ad7 Mon Sep 17 00:00:00 2001 From: rkathir-solink Date: Thu, 24 Jun 2021 11:53:09 -0400 Subject: [PATCH 29/41] fix item expression --- action.yml | 2 +- dist/operations/update.js | 2 +- src/operations/update.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 419f23c2..b4562c8c 100644 --- a/action.yml +++ b/action.yml @@ -44,7 +44,7 @@ inputs: description: 'Attribute values to be updated, Only required for update operation' required: false expressionAttributeFiles: - description: 'Attribute values to be updated, Only required for update operation' + description: 'Attribute files to be updated, Only required for update operation' required: false outputs: diff --git a/dist/operations/update.js b/dist/operations/update.js index c7523306..d761df35 100644 --- a/dist/operations/update.js +++ b/dist/operations/update.js @@ -36,7 +36,7 @@ class UpdateOperation { } async execute(input) { const ddb = helpers_1.createClient(input.region); - const item = input.key || await this.read(input.expressionAttributeFiles); + const item = input.expressionAttributeValues || await this.read(input.expressionAttributeFiles); await ddb.update({ TableName: input.table, Key: input.key, diff --git a/src/operations/update.ts b/src/operations/update.ts index 187976ae..7b1f8e36 100644 --- a/src/operations/update.ts +++ b/src/operations/update.ts @@ -54,7 +54,7 @@ export class UpdateOperation implements Operation { public async execute(input: UpdateOperationInput) { const ddb = createClient(input.region); - const item = input.key || await this.read(input.expressionAttributeFiles!); + const item = input.expressionAttributeValues || await this.read(input.expressionAttributeFiles!); await ddb.update({ TableName: input.table, From 48349b0e50f78896a9992019c1015faf8c49eaae Mon Sep 17 00:00:00 2001 From: rkathir-solink Date: Thu, 24 Jun 2021 13:26:37 -0400 Subject: [PATCH 30/41] bug fixes and refactoring --- dist/operations/update.js | 9 ++++----- src/operations/update.ts | 10 ++++------ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/dist/operations/update.js b/dist/operations/update.js index d761df35..981d1a35 100644 --- a/dist/operations/update.js +++ b/dist/operations/update.js @@ -2,23 +2,22 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.UpdateOperation = void 0; const Joi = require("joi"); -const fs = require("fs-extra"); +const fs_1 = require("fs"); const helpers_1 = require("../helpers"); const BaseInputSchema = Joi.object({ operation: Joi.string().lowercase().valid("update").required(), region: Joi.string().lowercase().required(), table: Joi.string().required(), + updateExpression: Joi.string().required() }); const InputSchema = Joi.alternatives([ BaseInputSchema.append({ - updateExpression: Joi.string().required(), expressionAttributeValues: Joi.string().required(), key: Joi.object().required(), }), BaseInputSchema.append({ - updateExpression: Joi.string().required(), expressionAttributeFiles: Joi.string().required(), - key: Joi.string().required(), + key: Joi.object().required(), }), ]).required(); class UpdateOperation { @@ -47,7 +46,7 @@ class UpdateOperation { }).promise(); } async read(path) { - const content = await fs.readFile(path, { encoding: "utf8" }); + const content = await fs_1.promises.readFile(path, { encoding: "utf8" }); return JSON.parse(content); } } diff --git a/src/operations/update.ts b/src/operations/update.ts index 7b1f8e36..70783730 100644 --- a/src/operations/update.ts +++ b/src/operations/update.ts @@ -1,5 +1,5 @@ import * as Joi from "joi"; -import * as fs from "fs-extra"; +import { promises as fs } from "fs"; import { createClient } from "../helpers"; import { Operation } from "./base"; @@ -7,18 +7,17 @@ const BaseInputSchema = Joi.object({ operation: Joi.string().lowercase().valid("update").required(), region: Joi.string().lowercase().required(), table: Joi.string().required(), + updateExpression: Joi.string().required() }); const InputSchema = Joi.alternatives([ BaseInputSchema.append({ - updateExpression: Joi.string().required(), expressionAttributeValues: Joi.string().required(), key: Joi.object().required(), }), BaseInputSchema.append({ - updateExpression: Joi.string().required(), expressionAttributeFiles: Joi.string().required(), - key: Joi.string().required(), + key: Joi.object().required(), }), ]).required(); @@ -26,13 +25,12 @@ export type UpdateOperationInput = { operation: "update"; region: string; table: string; -} & ({ updateExpression: string; +} & ({ expressionAttributeValues: string; expressionAttributeFiles?: never; key: { [key: string]: any }; } | { - updateExpression: string; expressionAttributeValues?: never; expressionAttributeFiles: string; key: { [key: string]: any }; From 92cc55166391c96f739b9283653ce8aab4975dfc Mon Sep 17 00:00:00 2001 From: rkathir-solink Date: Thu, 24 Jun 2021 13:37:01 -0400 Subject: [PATCH 31/41] remove build package --- package-lock.json | 312 +++------------------------------------------- package.json | 1 - 2 files changed, 18 insertions(+), 295 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4c207bd2..f1d453a7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -322,16 +322,6 @@ "integrity": "sha512-VoNqai1vR5anRF5Tuh/+SWDFk7xi7oMwHrHrbm1BprYXjB2RJsWLhUrStMssDxEl5lW/z3EUdg8RvH/IUBccSQ==", "dev": true }, - "@dabh/diagnostics": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.2.tgz", - "integrity": "sha512-+A1YivoVDNNVCdfozHSR8v/jyuuLTMXwjWuxPFlFlUapXoGc+Gj9mDlTDDfrwl7rXCl2tNZ0kE8sIBO6YOn96Q==", - "requires": { - "colorspace": "1.1.x", - "enabled": "2.0.x", - "kuler": "^2.0.0" - } - }, "@hapi/hoek": { "version": "9.2.0", "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.2.0.tgz", @@ -1073,11 +1063,6 @@ "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", "dev": true }, - "async": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.0.tgz", - "integrity": "sha512-TR2mEZFVOj2pLStYxLht7TyfuRzaydfpxr3k9RpHIzMgw7A64dzsdqCxH1WJyQdoe8T10nDXd9wnEigmiuHIZw==" - }, "at-least-node": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", @@ -1168,30 +1153,6 @@ "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", "dev": true }, - "build": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/build/-/build-0.1.4.tgz", - "integrity": "sha1-cH/gJv/O3crL/c3zVur9pk8VEEY=", - "requires": { - "cssmin": "0.3.x", - "jsmin": "1.x", - "jxLoader": "*", - "moo-server": "*", - "promised-io": "*", - "timespan": "2.x", - "uglify-js": "1.x", - "walker": "1.x", - "winston": "*", - "wrench": "1.3.x" - }, - "dependencies": { - "uglify-js": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-1.3.5.tgz", - "integrity": "sha1-S1v/+Rhu/7qoiOTJ6UvZ/EyUkp0=" - } - } - }, "builtin-modules": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", @@ -1371,30 +1332,6 @@ "wrap-ansi": "^6.2.0" } }, - "color": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/color/-/color-3.0.0.tgz", - "integrity": "sha512-jCpd5+s0s0t7p3pHQKpnJ0TpQKKdleP71LWcA0aqiljpiuAkOSUFN/dyH8ZwF0hRmFlrIuRhufds1QyEP9EB+w==", - "requires": { - "color-convert": "^1.9.1", - "color-string": "^1.5.2" - }, - "dependencies": { - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" - } - } - }, "color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -1407,16 +1344,8 @@ "color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" - }, - "color-string": { - "version": "1.5.5", - "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.5.5.tgz", - "integrity": "sha512-jgIoum0OfQfq9Whcfc2z/VhCNcmQjWbey6qBX0vqt7YICflUmBCh9E9CiQD5GSJ+Uehixm3NUwHVhqUAWRivZg==", - "requires": { - "color-name": "^1.0.0", - "simple-swizzle": "^0.2.2" - } + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true }, "colors": { "version": "1.0.3", @@ -1424,15 +1353,6 @@ "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=", "dev": true }, - "colorspace": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/colorspace/-/colorspace-1.1.2.tgz", - "integrity": "sha512-vt+OoIP2d76xLhjwbBaucYlNSpPsrJWPlBTtwCpQKIu6/CSMutyzX93O/Do0qzpH3YoHEes8YEFXyZ797rEhzQ==", - "requires": { - "color": "3.0.x", - "text-hex": "1.0.x" - } - }, "commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", @@ -1727,7 +1647,8 @@ "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true }, "cosmiconfig": { "version": "7.0.0", @@ -1770,11 +1691,6 @@ "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", "dev": true }, - "cssmin": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/cssmin/-/cssmin-0.3.2.tgz", - "integrity": "sha1-3c5MVHtRCuDVlKjx+/iq+OLFwA0=" - }, "cz-conventional-changelog": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/cz-conventional-changelog/-/cz-conventional-changelog-3.3.0.tgz", @@ -2024,11 +1940,6 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, - "enabled": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/enabled/-/enabled-2.0.0.tgz", - "integrity": "sha512-AKrN98kuwOzMIdAizXGI86UFBoo26CL21UM763y1h/GMSJ4/OHU9k2YlsmBpyScFo/wbLzWQJBMCW4+IO3/+OQ==" - }, "end-of-stream": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", @@ -2148,11 +2059,6 @@ "picomatch": "^2.2.1" } }, - "fast-safe-stringify": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz", - "integrity": "sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA==" - }, "fastq": { "version": "1.11.0", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.0.tgz", @@ -2162,11 +2068,6 @@ "reusify": "^1.0.4" } }, - "fecha": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.1.tgz", - "integrity": "sha512-MMMQ0ludy/nBs1/o0zVOiKTpG7qMbonKUzjJgQFEuvq6INZ1OraKPRAWkBq5vlKLOUMpmNYG1JoN3oDPUQ9m3Q==" - }, "figures": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", @@ -2216,11 +2117,6 @@ "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", "dev": true }, - "fn.name": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fn.name/-/fn.name-1.1.0.tgz", - "integrity": "sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==" - }, "from2": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", @@ -2653,7 +2549,8 @@ "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true }, "ini": { "version": "1.3.8", @@ -2878,7 +2775,8 @@ "is-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", - "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==" + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", + "dev": true }, "is-text-path": { "version": "1.0.1", @@ -2963,11 +2861,6 @@ "argparse": "^2.0.1" } }, - "jsmin": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/jsmin/-/jsmin-1.0.1.tgz", - "integrity": "sha1-570NzWSWw79IYyNb9GGj2YqjuYw=" - }, "json-parse-better-errors": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", @@ -3001,35 +2894,12 @@ "integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=", "dev": true }, - "jxLoader": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jxLoader/-/jxLoader-0.1.1.tgz", - "integrity": "sha1-ATTqUUTlM7WU/B/yX/GU4jXFPs0=", - "requires": { - "js-yaml": "0.3.x", - "moo-server": "1.3.x", - "promised-io": "*", - "walker": "1.x" - }, - "dependencies": { - "js-yaml": { - "version": "0.3.7", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-0.3.7.tgz", - "integrity": "sha1-1znY7oZGHlSzVNan19HyrZoWf2I=" - } - } - }, "kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", "dev": true }, - "kuler": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/kuler/-/kuler-2.0.0.tgz", - "integrity": "sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==" - }, "lines-and-columns": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", @@ -3138,25 +3008,6 @@ "chalk": "^4.0.0" } }, - "logform": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/logform/-/logform-2.2.0.tgz", - "integrity": "sha512-N0qPlqfypFx7UHNn4B3lzS/b0uLqt2hmuoa+PpuXNYgozdJYAyauF5Ky0BWVjrxDlMWiT3qN4zPq3vVAfZy7Yg==", - "requires": { - "colors": "^1.2.1", - "fast-safe-stringify": "^2.0.4", - "fecha": "^4.2.0", - "ms": "^2.1.1", - "triple-beam": "^1.3.0" - }, - "dependencies": { - "colors": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", - "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==" - } - } - }, "longest": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/longest/-/longest-2.0.1.tgz", @@ -3178,14 +3029,6 @@ "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", "dev": true }, - "makeerror": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.11.tgz", - "integrity": "sha1-4BpckQnyr3lmDk6LlYd5AYT1qWw=", - "requires": { - "tmpl": "1.0.x" - } - }, "map-obj": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.2.1.tgz", @@ -3522,15 +3365,11 @@ "integrity": "sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==", "dev": true }, - "moo-server": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/moo-server/-/moo-server-1.3.0.tgz", - "integrity": "sha1-XceVaVZaENbv7VQ5SR5p0jkuWPE=" - }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true }, "mute-stream": { "version": "0.0.7", @@ -5668,14 +5507,6 @@ "wrappy": "1" } }, - "one-time": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/one-time/-/one-time-1.0.0.tgz", - "integrity": "sha512-5DXOiRKwuSEcQ/l0kGCF6Q3jcADFv5tSmRaJck/OqkVFcOzutB134KRSfF0xDrL39MNnqxbHBbUUcjZIhTgb2g==", - "requires": { - "fn.name": "1.x.x" - } - }, "onetime": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", @@ -5960,12 +5791,8 @@ "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" - }, - "promised-io": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/promised-io/-/promised-io-0.3.6.tgz", - "integrity": "sha512-bNwZusuNIW4m0SPR8jooSyndD35ggirHlxVl/UhIaZD/F0OBv9ebfc6tNmbpZts3QXHggkjIBH8lvtnzhtcz0A==" + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "dev": true }, "pump": { "version": "3.0.0", @@ -6101,6 +5928,7 @@ "version": "3.6.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, "requires": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -6255,7 +6083,8 @@ "safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -6536,21 +6365,6 @@ } } }, - "simple-swizzle": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", - "integrity": "sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=", - "requires": { - "is-arrayish": "^0.3.1" - }, - "dependencies": { - "is-arrayish": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", - "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==" - } - } - }, "slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -6643,11 +6457,6 @@ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, - "stack-trace": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", - "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=" - }, "stream-combiner2": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/stream-combiner2/-/stream-combiner2-1.1.1.tgz", @@ -6705,6 +6514,7 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, "requires": { "safe-buffer": "~5.2.0" } @@ -6797,11 +6607,6 @@ "integrity": "sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ==", "dev": true }, - "text-hex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/text-hex/-/text-hex-1.0.0.tgz", - "integrity": "sha512-uuVGNWzgJ4yhRaNSiubPY7OjISw4sw4E5Uv0wbjp+OzcbmVU/rsT8ujgcXJhn9ypzsgr5vlzpPqP+MBBKcGvbg==" - }, "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -6817,11 +6622,6 @@ "readable-stream": "3" } }, - "timespan": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/timespan/-/timespan-2.3.0.tgz", - "integrity": "sha1-SQLOBAvRPYRcj1myfp1ZutbzmSk=" - }, "tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", @@ -6831,11 +6631,6 @@ "os-tmpdir": "~1.0.2" } }, - "tmpl": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", - "integrity": "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=" - }, "to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -6863,11 +6658,6 @@ "integrity": "sha1-n5up2e+odkw4dpi8v+sshI8RrbM=", "dev": true }, - "triple-beam": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.3.0.tgz", - "integrity": "sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw==" - }, "ts-node": { "version": "8.10.2", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.10.2.tgz", @@ -7076,7 +6866,8 @@ "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true }, "uuid": { "version": "3.3.2", @@ -7093,14 +6884,6 @@ "spdx-expression-parse": "^3.0.0" } }, - "walker": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.7.tgz", - "integrity": "sha1-L3+bj9ENZ3JisYqITijRlhjgKPs=", - "requires": { - "makeerror": "1.0.x" - } - }, "which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", @@ -7164,60 +6947,6 @@ } } }, - "winston": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/winston/-/winston-3.3.3.tgz", - "integrity": "sha512-oEXTISQnC8VlSAKf1KYSSd7J6IWuRPQqDdo8eoRNaYKLvwSb5+79Z3Yi1lrl6KDpU6/VWaxpakDAtb1oQ4n9aw==", - "requires": { - "@dabh/diagnostics": "^2.0.2", - "async": "^3.1.0", - "is-stream": "^2.0.0", - "logform": "^2.2.0", - "one-time": "^1.0.0", - "readable-stream": "^3.4.0", - "stack-trace": "0.0.x", - "triple-beam": "^1.3.0", - "winston-transport": "^4.4.0" - } - }, - "winston-transport": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/winston-transport/-/winston-transport-4.4.0.tgz", - "integrity": "sha512-Lc7/p3GtqtqPBYYtS6KCN3c77/2QCev51DvcJKbkFPQNoj1sinkGwLGFDxkXY9J6p9+EPnYs+D90uwbnaiURTw==", - "requires": { - "readable-stream": "^2.3.7", - "triple-beam": "^1.2.0" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, "word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", @@ -7253,11 +6982,6 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, - "wrench": { - "version": "1.3.9", - "resolved": "https://registry.npmjs.org/wrench/-/wrench-1.3.9.tgz", - "integrity": "sha1-bxPsNRRTF+spLKX2UxORskQRFBE=" - }, "xml2js": { "version": "0.4.19", "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", diff --git a/package.json b/package.json index e86c9a2e..02f96933 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,6 @@ "@actions/core": "^1.2.6", "@actions/glob": "^0.2.0", "aws-sdk": "^2.703.0", - "build": "^0.1.4", "fs-extra": "^10.0.0", "joi": "^17.4.0", "tsc": "^2.0.3" From 4292f42d0d2d1b40e703920bb0a71f9aa1ed2058 Mon Sep 17 00:00:00 2001 From: rkathir-solink Date: Thu, 24 Jun 2021 14:19:26 -0400 Subject: [PATCH 32/41] generalize --- dist/operations/update.js | 16 ++++++++++++---- src/operations/update.ts | 21 +++++++++++++++------ 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/dist/operations/update.js b/dist/operations/update.js index 981d1a35..ca127914 100644 --- a/dist/operations/update.js +++ b/dist/operations/update.js @@ -36,13 +36,21 @@ class UpdateOperation { async execute(input) { const ddb = helpers_1.createClient(input.region); const item = input.expressionAttributeValues || await this.read(input.expressionAttributeFiles); + let updateExp = `set`; + let attValues = {}; + const updateExpressions = input.updateExpression.split(','); + const expAttValues = item.split(','); + for (let i = 0; i < updateExpressions.length; i++) { + updateExp.concat(` ${updateExpressions[i]} = :${updateExpressions[i]},`); + Object.defineProperty(attValues, `:${updateExp[i]}`, { + value: `${expAttValues[i]}` + }); + } await ddb.update({ TableName: input.table, Key: input.key, - UpdateExpression: `set ${input.updateExpression} = :${input.updateExpression}`, - ExpressionAttributeValues: { - [`:${input.updateExpression}`]: `${item}` - } + UpdateExpression: updateExp, + ExpressionAttributeValues: attValues }).promise(); } async read(path) { diff --git a/src/operations/update.ts b/src/operations/update.ts index 70783730..130ae14c 100644 --- a/src/operations/update.ts +++ b/src/operations/update.ts @@ -53,14 +53,23 @@ export class UpdateOperation implements Operation { public async execute(input: UpdateOperationInput) { const ddb = createClient(input.region); const item = input.expressionAttributeValues || await this.read(input.expressionAttributeFiles!); - + let updateExp = `set`; + let attValues = {}; + const updateExpressions = input.updateExpression.split(','); + const expAttValues = item.split(','); + + for(let i=0; i { return JSON.parse(content); } -} +} \ No newline at end of file From 1d5ce470a7e1833c1133dfa2421407cb5b901267 Mon Sep 17 00:00:00 2001 From: rkathir-solink Date: Thu, 24 Jun 2021 14:54:19 -0400 Subject: [PATCH 33/41] build functions for generalization --- dist/operations/update.js | 34 +++++++++++++++++++++++++-------- src/operations/update.ts | 40 +++++++++++++++++++++++++++++++-------- 2 files changed, 58 insertions(+), 16 deletions(-) diff --git a/dist/operations/update.js b/dist/operations/update.js index ca127914..236aab11 100644 --- a/dist/operations/update.js +++ b/dist/operations/update.js @@ -38,14 +38,8 @@ class UpdateOperation { const item = input.expressionAttributeValues || await this.read(input.expressionAttributeFiles); let updateExp = `set`; let attValues = {}; - const updateExpressions = input.updateExpression.split(','); - const expAttValues = item.split(','); - for (let i = 0; i < updateExpressions.length; i++) { - updateExp.concat(` ${updateExpressions[i]} = :${updateExpressions[i]},`); - Object.defineProperty(attValues, `:${updateExp[i]}`, { - value: `${expAttValues[i]}` - }); - } + this.buildExpression(updateExp, input); + console.log(updateExp); await ddb.update({ TableName: input.table, Key: input.key, @@ -57,5 +51,29 @@ class UpdateOperation { const content = await fs_1.promises.readFile(path, { encoding: "utf8" }); return JSON.parse(content); } + async buildExpression(updateExp, input) { + const updateExpressions = input.updateExpression.split(','); + for (let i = 0; i < updateExpressions.length; i++) { + updateExp.concat(` ${updateExpressions[i]} = :${updateExpressions[i]},`); + } + } + async buildAttributes(updateExp, attValues, input) { + if (input.expressionAttributeValues) { + const expAttValues = input.expressionAttributeValues.split(','); + for (let i = 0; i < expAttValues.length; i++) { + Object.defineProperty(attValues, `:${updateExp[i]}`, { + value: `${expAttValues[i]}` + }); + } + } + else if (input.expressionAttributeFiles) { + const expAttValues = input.expressionAttributeFiles.split(','); + for (let i = 0; i < expAttValues.length; i++) { + Object.defineProperty(attValues, `:${updateExp[i]}`, { + value: `${expAttValues[i]}` + }); + } + } + } } exports.UpdateOperation = UpdateOperation; diff --git a/src/operations/update.ts b/src/operations/update.ts index 130ae14c..2372234b 100644 --- a/src/operations/update.ts +++ b/src/operations/update.ts @@ -55,15 +55,10 @@ export class UpdateOperation implements Operation { const item = input.expressionAttributeValues || await this.read(input.expressionAttributeFiles!); let updateExp = `set`; let attValues = {}; - const updateExpressions = input.updateExpression.split(','); - const expAttValues = item.split(','); - for(let i=0; i { return JSON.parse(content); } + + private async buildExpression(updateExp: string, input: UpdateOperationInput) { + const updateExpressions = input.updateExpression.split(','); + + for(let i=0; i Date: Thu, 24 Jun 2021 15:04:25 -0400 Subject: [PATCH 34/41] call build functions and console log --- dist/operations/update.js | 3 +++ src/operations/update.ts | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/dist/operations/update.js b/dist/operations/update.js index 236aab11..9903ba2b 100644 --- a/dist/operations/update.js +++ b/dist/operations/update.js @@ -39,7 +39,9 @@ class UpdateOperation { let updateExp = `set`; let attValues = {}; this.buildExpression(updateExp, input); + this.buildAttributes(updateExp, attValues, input); console.log(updateExp); + console.log(attValues); await ddb.update({ TableName: input.table, Key: input.key, @@ -56,6 +58,7 @@ class UpdateOperation { for (let i = 0; i < updateExpressions.length; i++) { updateExp.concat(` ${updateExpressions[i]} = :${updateExpressions[i]},`); } + return updateExp; } async buildAttributes(updateExp, attValues, input) { if (input.expressionAttributeValues) { diff --git a/src/operations/update.ts b/src/operations/update.ts index 2372234b..7aef36fa 100644 --- a/src/operations/update.ts +++ b/src/operations/update.ts @@ -57,8 +57,10 @@ export class UpdateOperation implements Operation { let attValues = {}; this.buildExpression(updateExp, input); + this.buildAttributes(updateExp, attValues, input); console.log(updateExp); + console.log(attValues); await ddb.update({ TableName: input.table, @@ -80,6 +82,8 @@ export class UpdateOperation implements Operation { for(let i=0; i Date: Fri, 25 Jun 2021 11:50:48 -0400 Subject: [PATCH 35/41] dynamically build inputs for update --- dist/operations/update.js | 37 ++++++++++++++++++++-------------- src/operations/update.ts | 42 ++++++++++++++++++++++++--------------- 2 files changed, 48 insertions(+), 31 deletions(-) diff --git a/dist/operations/update.js b/dist/operations/update.js index 9903ba2b..abcabf64 100644 --- a/dist/operations/update.js +++ b/dist/operations/update.js @@ -35,13 +35,10 @@ class UpdateOperation { } async execute(input) { const ddb = helpers_1.createClient(input.region); - const item = input.expressionAttributeValues || await this.read(input.expressionAttributeFiles); let updateExp = `set`; let attValues = {}; - this.buildExpression(updateExp, input); - this.buildAttributes(updateExp, attValues, input); - console.log(updateExp); - console.log(attValues); + const expressions = await this.buildExpression(updateExp, input); + const attributes = await this.buildAttributes(expressions, attValues, input); await ddb.update({ TableName: input.table, Key: input.key, @@ -56,27 +53,37 @@ class UpdateOperation { async buildExpression(updateExp, input) { const updateExpressions = input.updateExpression.split(','); for (let i = 0; i < updateExpressions.length; i++) { - updateExp.concat(` ${updateExpressions[i]} = :${updateExpressions[i]},`); + if (i === updateExpressions.length - 1) { + updateExp = ''.concat(` ${updateExpressions[i]} = :${updateExpressions[i]}`); + } + else { + updateExp = ''.concat(` ${updateExpressions[i]} = :${updateExpressions[i]},`); + } } return updateExp; } async buildAttributes(updateExp, attValues, input) { + const updateExpressions = updateExp.split(','); if (input.expressionAttributeValues) { - const expAttValues = input.expressionAttributeValues.split(','); - for (let i = 0; i < expAttValues.length; i++) { - Object.defineProperty(attValues, `:${updateExp[i]}`, { - value: `${expAttValues[i]}` - }); + const expAttValues = input.expressionAttributeValues.split(', '); + const keyValues = []; + for (let i = 0; i < updateExpressions.length; i++) { + updateExpressions[i] = updateExpressions[i].substring(updateExpressions[i].indexOf(":")); + keyValues[i] = [updateExpressions[i], expAttValues[i]]; } + attValues = Object.fromEntries(keyValues); } else if (input.expressionAttributeFiles) { const expAttValues = input.expressionAttributeFiles.split(','); - for (let i = 0; i < expAttValues.length; i++) { - Object.defineProperty(attValues, `:${updateExp[i]}`, { - value: `${expAttValues[i]}` - }); + const keyValues = []; + for (let i = 0; i < updateExpressions.length; i++) { + updateExpressions[i] = updateExpressions[i].substring(updateExpressions[i].indexOf(":")); + keyValues[i] = [updateExpressions[i], await this.read(expAttValues[i])]; } + attValues = Object.fromEntries(keyValues); } + console.log(attValues); + return attValues; } } exports.UpdateOperation = UpdateOperation; diff --git a/src/operations/update.ts b/src/operations/update.ts index 7aef36fa..c06a8b6b 100644 --- a/src/operations/update.ts +++ b/src/operations/update.ts @@ -52,15 +52,11 @@ export class UpdateOperation implements Operation { public async execute(input: UpdateOperationInput) { const ddb = createClient(input.region); - const item = input.expressionAttributeValues || await this.read(input.expressionAttributeFiles!); let updateExp = `set`; let attValues = {}; - this.buildExpression(updateExp, input); - this.buildAttributes(updateExp, attValues, input); - - console.log(updateExp); - console.log(attValues); + const expressions = await this.buildExpression(updateExp, input); + const attributes = await this.buildAttributes(expressions, attValues, input); await ddb.update({ TableName: input.table, @@ -80,30 +76,44 @@ export class UpdateOperation implements Operation { const updateExpressions = input.updateExpression.split(','); for(let i=0; i Date: Fri, 25 Jun 2021 11:54:41 -0400 Subject: [PATCH 36/41] replace input variables for update and console log --- dist/operations/update.js | 7 ++++--- src/operations/update.ts | 8 +++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/dist/operations/update.js b/dist/operations/update.js index abcabf64..6a79e7f4 100644 --- a/dist/operations/update.js +++ b/dist/operations/update.js @@ -39,11 +39,13 @@ class UpdateOperation { let attValues = {}; const expressions = await this.buildExpression(updateExp, input); const attributes = await this.buildAttributes(expressions, attValues, input); + console.log(expressions); + console.log(attributes); await ddb.update({ TableName: input.table, Key: input.key, - UpdateExpression: updateExp, - ExpressionAttributeValues: attValues + UpdateExpression: expressions, + ExpressionAttributeValues: attributes }).promise(); } async read(path) { @@ -82,7 +84,6 @@ class UpdateOperation { } attValues = Object.fromEntries(keyValues); } - console.log(attValues); return attValues; } } diff --git a/src/operations/update.ts b/src/operations/update.ts index c06a8b6b..455922ce 100644 --- a/src/operations/update.ts +++ b/src/operations/update.ts @@ -58,11 +58,14 @@ export class UpdateOperation implements Operation { const expressions = await this.buildExpression(updateExp, input); const attributes = await this.buildAttributes(expressions, attValues, input); + console.log(expressions); + console.log(attributes); + await ddb.update({ TableName: input.table, Key: input.key, - UpdateExpression: updateExp, - ExpressionAttributeValues: attValues + UpdateExpression: expressions, + ExpressionAttributeValues: attributes }).promise(); } @@ -113,7 +116,6 @@ export class UpdateOperation implements Operation { attValues = Object.fromEntries(keyValues); } - console.log(attValues); return attValues; } } \ No newline at end of file From 26727d824c8921d03a369d77f8a116e2791159a7 Mon Sep 17 00:00:00 2001 From: rkathir-solink Date: Fri, 25 Jun 2021 12:01:28 -0400 Subject: [PATCH 37/41] handle first expression case --- dist/operations/update.js | 7 +++++-- src/operations/update.ts | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/dist/operations/update.js b/dist/operations/update.js index 6a79e7f4..857df2e2 100644 --- a/dist/operations/update.js +++ b/dist/operations/update.js @@ -35,7 +35,7 @@ class UpdateOperation { } async execute(input) { const ddb = helpers_1.createClient(input.region); - let updateExp = `set`; + let updateExp = ``; let attValues = {}; const expressions = await this.buildExpression(updateExp, input); const attributes = await this.buildAttributes(expressions, attValues, input); @@ -55,7 +55,10 @@ class UpdateOperation { async buildExpression(updateExp, input) { const updateExpressions = input.updateExpression.split(','); for (let i = 0; i < updateExpressions.length; i++) { - if (i === updateExpressions.length - 1) { + if (i === 0) { + updateExp = 'set '.concat(` ${updateExpressions[i]} = :${updateExpressions[i]},`); + } + else if (i === updateExpressions.length - 1) { updateExp = ''.concat(` ${updateExpressions[i]} = :${updateExpressions[i]}`); } else { diff --git a/src/operations/update.ts b/src/operations/update.ts index 455922ce..3046ab9f 100644 --- a/src/operations/update.ts +++ b/src/operations/update.ts @@ -52,7 +52,7 @@ export class UpdateOperation implements Operation { public async execute(input: UpdateOperationInput) { const ddb = createClient(input.region); - let updateExp = `set`; + let updateExp = ``; let attValues = {}; const expressions = await this.buildExpression(updateExp, input); @@ -79,7 +79,10 @@ export class UpdateOperation implements Operation { const updateExpressions = input.updateExpression.split(','); for(let i=0; i Date: Fri, 25 Jun 2021 12:27:48 -0400 Subject: [PATCH 38/41] handle single expression/attribute case --- dist/operations/update.js | 7 +++++-- src/operations/update.ts | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/dist/operations/update.js b/dist/operations/update.js index 857df2e2..207860ea 100644 --- a/dist/operations/update.js +++ b/dist/operations/update.js @@ -55,8 +55,11 @@ class UpdateOperation { async buildExpression(updateExp, input) { const updateExpressions = input.updateExpression.split(','); for (let i = 0; i < updateExpressions.length; i++) { - if (i === 0) { - updateExp = 'set '.concat(` ${updateExpressions[i]} = :${updateExpressions[i]},`); + if (i === 0 && updateExpressions.length > 1) { + updateExp = 'set'.concat(` ${updateExpressions[i]} = :${updateExpressions[i]},`); + } + else if (i === 0 && updateExpressions.length === 1) { + updateExp = 'set'.concat(` ${updateExpressions[i]} = :${updateExpressions[i]}`); } else if (i === updateExpressions.length - 1) { updateExp = ''.concat(` ${updateExpressions[i]} = :${updateExpressions[i]}`); diff --git a/src/operations/update.ts b/src/operations/update.ts index 3046ab9f..5db9bcb0 100644 --- a/src/operations/update.ts +++ b/src/operations/update.ts @@ -79,8 +79,11 @@ export class UpdateOperation implements Operation { const updateExpressions = input.updateExpression.split(','); for(let i=0; i 1) { + updateExp = 'set'.concat(` ${updateExpressions[i]} = :${updateExpressions[i]},`); + } + else if(i===0 && updateExpressions.length === 1) { + updateExp = 'set'.concat(` ${updateExpressions[i]} = :${updateExpressions[i]}`); } else if(i===updateExpressions.length-1) { updateExp = ''.concat(` ${updateExpressions[i]} = :${updateExpressions[i]}`); From 4ebd97bf8f33c6eaddafa9b720ded6076be182bb Mon Sep 17 00:00:00 2001 From: rkathir-solink Date: Fri, 25 Jun 2021 12:33:08 -0400 Subject: [PATCH 39/41] remove tsc from package.json --- package-lock.json | 5 ----- package.json | 3 +-- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index f1d453a7..f7c2c076 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6679,11 +6679,6 @@ } } }, - "tsc": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/tsc/-/tsc-2.0.3.tgz", - "integrity": "sha512-SN+9zBUtrpUcOpaUO7GjkEHgWtf22c7FKbKCA4e858eEM7Qz86rRDpgOU2lBIDf0fLCsEg65ms899UMUIB2+Ow==" - }, "tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", diff --git a/package.json b/package.json index 02f96933..a41cd444 100644 --- a/package.json +++ b/package.json @@ -52,8 +52,7 @@ "@actions/glob": "^0.2.0", "aws-sdk": "^2.703.0", "fs-extra": "^10.0.0", - "joi": "^17.4.0", - "tsc": "^2.0.3" + "joi": "^17.4.0" }, "config": { "commitizen": { From c31f0a3c492744cfbd06dcf7e6a79f1286b583a3 Mon Sep 17 00:00:00 2001 From: rkathir-solink Date: Mon, 28 Jun 2021 09:16:43 -0400 Subject: [PATCH 40/41] string manipulation fix --- dist/operations/update.js | 8 ++++---- src/operations/update.ts | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dist/operations/update.js b/dist/operations/update.js index 207860ea..fd2c1b5d 100644 --- a/dist/operations/update.js +++ b/dist/operations/update.js @@ -56,16 +56,16 @@ class UpdateOperation { const updateExpressions = input.updateExpression.split(','); for (let i = 0; i < updateExpressions.length; i++) { if (i === 0 && updateExpressions.length > 1) { - updateExp = 'set'.concat(` ${updateExpressions[i]} = :${updateExpressions[i]},`); + updateExp = `set ${updateExpressions[i]} = :${updateExpressions[i]},`; } else if (i === 0 && updateExpressions.length === 1) { - updateExp = 'set'.concat(` ${updateExpressions[i]} = :${updateExpressions[i]}`); + updateExp = `set ${updateExpressions[i]} = :${updateExpressions[i]}`; } else if (i === updateExpressions.length - 1) { - updateExp = ''.concat(` ${updateExpressions[i]} = :${updateExpressions[i]}`); + updateExp = updateExp.concat(` ${updateExpressions[i]} = :${updateExpressions[i]}`); } else { - updateExp = ''.concat(` ${updateExpressions[i]} = :${updateExpressions[i]},`); + updateExp = updateExp.concat(` ${updateExpressions[i]} = :${updateExpressions[i]},`); } } return updateExp; diff --git a/src/operations/update.ts b/src/operations/update.ts index 5db9bcb0..ef102b92 100644 --- a/src/operations/update.ts +++ b/src/operations/update.ts @@ -80,16 +80,16 @@ export class UpdateOperation implements Operation { for(let i=0; i 1) { - updateExp = 'set'.concat(` ${updateExpressions[i]} = :${updateExpressions[i]},`); + updateExp = `set ${updateExpressions[i]} = :${updateExpressions[i]},`; } else if(i===0 && updateExpressions.length === 1) { - updateExp = 'set'.concat(` ${updateExpressions[i]} = :${updateExpressions[i]}`); + updateExp = `set ${updateExpressions[i]} = :${updateExpressions[i]}`; } else if(i===updateExpressions.length-1) { - updateExp = ''.concat(` ${updateExpressions[i]} = :${updateExpressions[i]}`); + updateExp = updateExp.concat(` ${updateExpressions[i]} = :${updateExpressions[i]}`); } else { - updateExp = ''.concat(` ${updateExpressions[i]} = :${updateExpressions[i]},`); + updateExp = updateExp.concat(` ${updateExpressions[i]} = :${updateExpressions[i]},`); } } From 9ff860e817aec4c823823e2a5617a568c88f2190 Mon Sep 17 00:00:00 2001 From: rkathir-solink Date: Mon, 28 Jun 2021 09:31:00 -0400 Subject: [PATCH 41/41] replace concat funtion with += string concat --- dist/operations/update.js | 4 ++-- src/operations/update.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/operations/update.js b/dist/operations/update.js index fd2c1b5d..ddc86cfe 100644 --- a/dist/operations/update.js +++ b/dist/operations/update.js @@ -62,10 +62,10 @@ class UpdateOperation { updateExp = `set ${updateExpressions[i]} = :${updateExpressions[i]}`; } else if (i === updateExpressions.length - 1) { - updateExp = updateExp.concat(` ${updateExpressions[i]} = :${updateExpressions[i]}`); + updateExp += ` ${updateExpressions[i]} = :${updateExpressions[i]}`; } else { - updateExp = updateExp.concat(` ${updateExpressions[i]} = :${updateExpressions[i]},`); + updateExp += ` ${updateExpressions[i]} = :${updateExpressions[i]},`; } } return updateExp; diff --git a/src/operations/update.ts b/src/operations/update.ts index ef102b92..56aefe91 100644 --- a/src/operations/update.ts +++ b/src/operations/update.ts @@ -86,10 +86,10 @@ export class UpdateOperation implements Operation { updateExp = `set ${updateExpressions[i]} = :${updateExpressions[i]}`; } else if(i===updateExpressions.length-1) { - updateExp = updateExp.concat(` ${updateExpressions[i]} = :${updateExpressions[i]}`); + updateExp += ` ${updateExpressions[i]} = :${updateExpressions[i]}`; } else { - updateExp = updateExp.concat(` ${updateExpressions[i]} = :${updateExpressions[i]},`); + updateExp += ` ${updateExpressions[i]} = :${updateExpressions[i]},`; } }