@field123/hacksprint-2022-js-sdk-test-response-generation 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/dist/README.md +0 -43
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -145
- package/dist/cli.js.map +0 -1
- package/dist/cli.mjs +0 -145
- package/dist/cli.mjs.map +0 -1
- package/dist/main.tf +0 -164
- package/dist/package.json +0 -40
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@field123/hacksprint-2022-js-sdk-test-response-generation",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.3",
|
4
4
|
"main": "dist/cli.js",
|
5
5
|
"repository": "https://gitlab.elasticpath.com/Michelle.Wan/hacksprint-2022-js-sdk-test-response-generation.git",
|
6
6
|
"author": "Elastic Path",
|
package/dist/README.md
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
# @field123/hacksprint-2022-js-sdk-test-response-generation
|
2
|
-
|
3
|
-
# Test Data Retrival Script
|
4
|
-
|
5
|
-
The script populates a store with test data, runs CURL calls to get data then tears down the data to create a clean slate.
|
6
|
-
|
7
|
-
Utilizes the [EPCC Terraform Provider](https://registry.terraform.io/providers/elasticpath/epcc/latest) to populate and tear down down data in a store.
|
8
|
-
|
9
|
-
## Setup
|
10
|
-
|
11
|
-
Create a `.env` file based on the `.env.example` file.
|
12
|
-
|
13
|
-
## Install
|
14
|
-
|
15
|
-
```sh
|
16
|
-
yarn add -D @field123/hacksprint-2022-js-sdk-test-response-generation
|
17
|
-
```
|
18
|
-
|
19
|
-
## Usage
|
20
|
-
|
21
|
-
```sh
|
22
|
-
npx hacksprint-2022-js-sdk-test-response-generation endpoints -s <source> -o <dest> -e <environment-file>
|
23
|
-
```
|
24
|
-
|
25
|
-
```sh
|
26
|
-
npx hacksprint-2022-js-sdk-test-response-generation endpoints -s ./postman-export/postman_collection.json -o ./output -e ./postman-export/postman_environment.json
|
27
|
-
```
|
28
|
-
|
29
|
-
```sh
|
30
|
-
npx hacksprint-2022-js-sdk-test-response-generation endpoints -s ./postman-export/postman_collection.json -o ./output -e ./postman-export/postman_environment.json -v
|
31
|
-
```
|
32
|
-
|
33
|
-
| Key | CLI opt | Default | Description |
|
34
|
-
| ---- | ----------------- | -------- | ------------------------------------------------------ |
|
35
|
-
| s | --source \<file\> | required | Source postman collection json file. |
|
36
|
-
| e | --env \<file\> | required | Source postman environment json file. |
|
37
|
-
| o | --output \<dir\> | \<dir\> | Output location for the generated endpoint json files. |
|
38
|
-
| v | --verbose | false | Logs details of terraform commands to console. |
|
39
|
-
| help | -h, --help | n/a | display help for command |
|
40
|
-
|
41
|
-
## Sources
|
42
|
-
|
43
|
-
`main.tf` comes from this repo: https://gitlab.elasticpath.com/commerce-cloud/playground/sample-catalogs-accelerator/-/blob/MT-11900/store-scope/variants/get-started-with-pcm-catalog/main.tf
|
package/dist/cli.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
|
package/dist/cli.js
DELETED
@@ -1,145 +0,0 @@
|
|
1
|
-
var __defProp = Object.defineProperty;
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
6
|
-
var __spreadValues = (a, b) => {
|
7
|
-
for (var prop in b || (b = {}))
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
10
|
-
if (__getOwnPropSymbols)
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
12
|
-
if (__propIsEnum.call(b, prop))
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
14
|
-
}
|
15
|
-
return a;
|
16
|
-
};
|
17
|
-
|
18
|
-
// src/cli.ts
|
19
|
-
var import_commander = require("commander");
|
20
|
-
|
21
|
-
// src/load-env.ts
|
22
|
-
var import_dotenv = require("dotenv");
|
23
|
-
function loadEnv() {
|
24
|
-
const result = (0, import_dotenv.config)();
|
25
|
-
if (result.error) {
|
26
|
-
throw new Error("Failed to load environment variables. Check .env exists and is setup to match example.");
|
27
|
-
}
|
28
|
-
return result.parsed;
|
29
|
-
}
|
30
|
-
|
31
|
-
// src/newman-exec.ts
|
32
|
-
var import_newman = require("newman");
|
33
|
-
var import_fs = require("fs");
|
34
|
-
async function executeCollection(options, env) {
|
35
|
-
const postmanCollection = await getPostmanCollection(options.source);
|
36
|
-
const postmanEnvironment = await getPostmanEnvironment(options.env);
|
37
|
-
return new Promise((resolve, reject) => {
|
38
|
-
(0, import_newman.run)(__spreadValues({
|
39
|
-
collection: postmanCollection,
|
40
|
-
reporters: ["cli", "@field123/ep-resp"],
|
41
|
-
reporter: {
|
42
|
-
"@field123/ep-resp": __spreadValues({}, options)
|
43
|
-
},
|
44
|
-
environment: postmanEnvironment
|
45
|
-
}, env ? { envVar: createEnvironment(env) } : {}), (err) => {
|
46
|
-
if (err) {
|
47
|
-
reject(err);
|
48
|
-
}
|
49
|
-
console.log("collection run complete!");
|
50
|
-
resolve();
|
51
|
-
});
|
52
|
-
});
|
53
|
-
}
|
54
|
-
function createEnvironment(env) {
|
55
|
-
return [
|
56
|
-
{
|
57
|
-
key: "clientID",
|
58
|
-
value: env.EPCC_CLIENT_ID
|
59
|
-
},
|
60
|
-
{
|
61
|
-
key: "clientSecret",
|
62
|
-
value: env.EPCC_CLIENT_SECRET
|
63
|
-
}
|
64
|
-
];
|
65
|
-
}
|
66
|
-
function getPostmanEnvironment(source) {
|
67
|
-
console.log(`Attempting to load postman environment file from ${source}`);
|
68
|
-
return getFile(source);
|
69
|
-
}
|
70
|
-
function getPostmanCollection(source) {
|
71
|
-
console.log(`Attempting to load postman collection file from ${source}`);
|
72
|
-
return getFile(source);
|
73
|
-
}
|
74
|
-
function getFile(name) {
|
75
|
-
return new Promise((resolve, reject) => {
|
76
|
-
(0, import_fs.readFile)(name, "utf-8", (err, data) => {
|
77
|
-
if (err) {
|
78
|
-
reject(err);
|
79
|
-
}
|
80
|
-
resolve(JSON.parse(data));
|
81
|
-
});
|
82
|
-
});
|
83
|
-
}
|
84
|
-
|
85
|
-
// src/terraform.ts
|
86
|
-
var import_child_process = require("child_process");
|
87
|
-
function applyTerraform(options = { verbose: false }) {
|
88
|
-
console.log("Attempting to terraform apply...");
|
89
|
-
return handleTerraformCommand(options, "apply", "-auto-approve").then(() => console.log("Applied terraform successfully!"));
|
90
|
-
}
|
91
|
-
function destroyTerraform(options = { verbose: false }) {
|
92
|
-
console.log("Attempting to terraform destroy...");
|
93
|
-
return handleTerraformCommand(options, "destroy", "-auto-approve").then(() => console.log("Destroyed terraform successfully!"));
|
94
|
-
}
|
95
|
-
function handleTerraformCommand(options, ...args) {
|
96
|
-
return new Promise((resolve, reject) => {
|
97
|
-
try {
|
98
|
-
const child = (0, import_child_process.spawn)("terraform", args);
|
99
|
-
if (options.verbose) {
|
100
|
-
child.stdout.setEncoding("utf8");
|
101
|
-
child.stdout.on("data", (data) => {
|
102
|
-
console.log("stdout: " + data);
|
103
|
-
});
|
104
|
-
child.stderr.on("data", (data) => {
|
105
|
-
console.log("stderr: " + data);
|
106
|
-
});
|
107
|
-
}
|
108
|
-
child.on("close", (code) => {
|
109
|
-
if (code !== 0) {
|
110
|
-
return reject(`terraform running failed with ${code}`);
|
111
|
-
}
|
112
|
-
resolve();
|
113
|
-
});
|
114
|
-
} catch (error) {
|
115
|
-
console.log(`error inside terraform with args ${args}: `, error);
|
116
|
-
reject(error);
|
117
|
-
}
|
118
|
-
});
|
119
|
-
}
|
120
|
-
|
121
|
-
// src/cli.ts
|
122
|
-
function initiateCli() {
|
123
|
-
import_commander.program.name("ep-resource-json");
|
124
|
-
import_commander.program.command("endpoints").description("Used to fetch json response data from Elastic Path endpoints and output them into json files.").requiredOption("-s, --source <source>", "Source postman collection json file.").requiredOption("-e, --env <environment-file>", "Source postman environment json file.").option("-o, --output <output>", "Output location for the generated endpoint json files.", process.cwd()).option("-v, --verbose", "Logs details of terraform commands to console.", false).action(outputJsonResponesAction);
|
125
|
-
import_commander.program.command("ter-destroy").description("Run terraform destroy in isolation.").action(isolatedTerraformDestroyAction);
|
126
|
-
import_commander.program.parse(process.argv);
|
127
|
-
console.log("program: ", import_commander.program.opts());
|
128
|
-
}
|
129
|
-
function outputJsonResponesAction(args) {
|
130
|
-
const env = loadEnv();
|
131
|
-
return applyTerraform({ verbose: args.verbose }).then(() => {
|
132
|
-
return executeCollection(args, env);
|
133
|
-
}).then(() => {
|
134
|
-
return destroyTerraform({ verbose: args.verbose });
|
135
|
-
}).catch((err) => {
|
136
|
-
destroyTerraform({ verbose: args.verbose });
|
137
|
-
console.error("error apply terraform: ", err);
|
138
|
-
});
|
139
|
-
}
|
140
|
-
function isolatedTerraformDestroyAction() {
|
141
|
-
loadEnv();
|
142
|
-
return destroyTerraform();
|
143
|
-
}
|
144
|
-
initiateCli();
|
145
|
-
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/cli.ts","../src/load-env.ts","../src/newman-exec.ts","../src/terraform.ts"],"sourcesContent":["import { program } from \"commander\";\nimport { loadEnv } from \"./load-env\";\nimport { executeCollection } from \"./newman-exec\";\nimport { applyTerraform, destroyTerraform } from \"./terraform\";\nimport { EndpointCliOptions } from \"./types\";\n\n/**\n * Checks if the script has been provided the required arguments.\n */\nfunction initiateCli(): void {\n program.name(\"ep-resource-json\");\n\n program\n .command(\"endpoints\")\n .description(\n \"Used to fetch json response data from Elastic Path endpoints and output them into json files.\"\n )\n .requiredOption(\n \"-s, --source <source>\",\n \"Source postman collection json file.\"\n )\n .requiredOption(\n \"-e, --env <environment-file>\",\n \"Source postman environment json file.\"\n )\n .option(\n \"-o, --output <output>\",\n \"Output location for the generated endpoint json files.\",\n process.cwd()\n )\n .option(\n \"-v, --verbose\",\n \"Logs details of terraform commands to console.\",\n false\n )\n .action(outputJsonResponesAction);\n\n program\n .command(\"ter-destroy\")\n .description(\"Run terraform destroy in isolation.\")\n .action(isolatedTerraformDestroyAction);\n\n program.parse(process.argv);\n\n // const { source } = program.opts<{ source: string }>();\n\n console.log(\"program: \", program.opts());\n}\nfunction outputJsonResponesAction(args: EndpointCliOptions): Promise<void> {\n const env = loadEnv();\n return applyTerraform({ verbose: args.verbose })\n .then(() => {\n return executeCollection(args, env);\n })\n .then(() => {\n return destroyTerraform({ verbose: args.verbose });\n })\n .catch((err) => {\n destroyTerraform({ verbose: args.verbose });\n console.error(\"error apply terraform: \", err);\n });\n}\n\nfunction isolatedTerraformDestroyAction(): Promise<void> {\n loadEnv();\n return destroyTerraform();\n}\n\ninitiateCli();\n","import { config as dotEnvConfig } from \"dotenv\";\nimport { EPEnv } from \"./types\";\n\nexport function loadEnv(): EPEnv {\n const result = dotEnvConfig();\n if (result.error) {\n throw new Error(\n \"Failed to load environment variables. Check .env exists and is setup to match example.\"\n );\n }\n // Casting parsed response.\n return result!.parsed as EPEnv;\n}\n","import { run } from \"newman\";\nimport { readFile } from \"fs\";\nimport type {\n CollectionDefinition,\n VariableScopeDefinition,\n} from \"postman-collection\";\nimport { EndpointCliOptions, EPEnv } from \"./types\";\n\nexport async function executeCollection(\n options: EndpointCliOptions,\n env?: EPEnv\n): Promise<void> {\n const postmanCollection = await getPostmanCollection(options.source);\n const postmanEnvironment = await getPostmanEnvironment(options.env);\n return new Promise((resolve, reject) => {\n run(\n {\n collection: postmanCollection,\n reporters: [\"cli\", \"@field123/ep-resp\"],\n reporter: {\n \"@field123/ep-resp\": {\n ...options,\n },\n },\n environment: postmanEnvironment,\n ...(env ? { envVar: createEnvironment(env) } : {}),\n },\n (err) => {\n if (err) {\n reject(err);\n }\n console.log(\"collection run complete!\");\n resolve();\n }\n );\n });\n}\n\nfunction createEnvironment(env: EPEnv): { key: string; value: string }[] {\n return [\n {\n key: \"clientID\",\n value: env.EPCC_CLIENT_ID,\n },\n {\n key: \"clientSecret\",\n value: env.EPCC_CLIENT_SECRET,\n },\n ];\n}\n\nfunction getPostmanEnvironment(\n source: string\n): Promise<VariableScopeDefinition> {\n console.log(`Attempting to load postman environment file from ${source}`);\n return getFile(source);\n}\n\nfunction getPostmanCollection(source: string): Promise<CollectionDefinition> {\n console.log(`Attempting to load postman collection file from ${source}`);\n return getFile(source);\n}\n\nfunction getFile(name: string): Promise<any> {\n return new Promise((resolve, reject) => {\n readFile(name, \"utf-8\", (err, data) => {\n if (err) {\n reject(err);\n }\n resolve(JSON.parse(data));\n });\n });\n}\n","import { spawn } from \"child_process\";\n\ninterface TerraformOptions {\n verbose: boolean;\n}\n\nexport function applyTerraform(\n options: TerraformOptions = { verbose: false }\n): Promise<void> {\n console.log(\"Attempting to terraform apply...\");\n return handleTerraformCommand(options, \"apply\", \"-auto-approve\").then(() =>\n console.log(\"Applied terraform successfully!\")\n );\n}\n\nexport function destroyTerraform(\n options: TerraformOptions = { verbose: false }\n): Promise<void> {\n console.log(\"Attempting to terraform destroy...\");\n return handleTerraformCommand(options, \"destroy\", \"-auto-approve\").then(() =>\n console.log(\"Destroyed terraform successfully!\")\n );\n}\n\nfunction handleTerraformCommand(\n options: TerraformOptions,\n ...args: string[]\n): Promise<void> {\n return new Promise((resolve, reject) => {\n try {\n const child = spawn(\"terraform\", args);\n\n if (options.verbose) {\n child.stdout.setEncoding(\"utf8\");\n child.stdout.on(\"data\", (data) => {\n console.log(\"stdout: \" + data);\n });\n child.stderr.on(\"data\", (data) => {\n console.log(\"stderr: \" + data);\n });\n }\n\n child.on(\"close\", (code) => {\n if (code !== 0) {\n return reject(`terraform running failed with ${code}`);\n }\n resolve();\n });\n } catch (error) {\n console.log(`error inside terraform with args ${args}: `, error);\n reject(error);\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;A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,2BACG,QAAQ,aAAa,EACrB,YAAY,qCAAqC,EACjD,OAAO,8BAA8B;AAExC,2BAAQ,MAAM,QAAQ,IAAI;AAI1B,UAAQ,IAAI,aAAa,yBAAQ,KAAK,CAAC;AACzC;AACA,kCAAkC,MAAyC;AACzE,QAAM,MAAM,QAAQ;AACpB,SAAO,eAAe,EAAE,SAAS,KAAK,QAAQ,CAAC,EAC5C,KAAK,MAAM;AACV,WAAO,kBAAkB,MAAM,GAAG;AAAA,EACpC,CAAC,EACA,KAAK,MAAM;AACV,WAAO,iBAAiB,EAAE,SAAS,KAAK,QAAQ,CAAC;AAAA,EACnD,CAAC,EACA,MAAM,CAAC,QAAQ;AACd,qBAAiB,EAAE,SAAS,KAAK,QAAQ,CAAC;AAC1C,YAAQ,MAAM,2BAA2B,GAAG;AAAA,EAC9C,CAAC;AACL;AAEA,0CAAyD;AACvD,UAAQ;AACR,SAAO,iBAAiB;AAC1B;AAEA,YAAY;","names":[]}
|
package/dist/cli.mjs
DELETED
@@ -1,145 +0,0 @@
|
|
1
|
-
var __defProp = Object.defineProperty;
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
6
|
-
var __spreadValues = (a, b) => {
|
7
|
-
for (var prop in b || (b = {}))
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
10
|
-
if (__getOwnPropSymbols)
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
12
|
-
if (__propIsEnum.call(b, prop))
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
14
|
-
}
|
15
|
-
return a;
|
16
|
-
};
|
17
|
-
|
18
|
-
// src/cli.ts
|
19
|
-
import { program } from "commander";
|
20
|
-
|
21
|
-
// src/load-env.ts
|
22
|
-
import { config as dotEnvConfig } from "dotenv";
|
23
|
-
function loadEnv() {
|
24
|
-
const result = dotEnvConfig();
|
25
|
-
if (result.error) {
|
26
|
-
throw new Error("Failed to load environment variables. Check .env exists and is setup to match example.");
|
27
|
-
}
|
28
|
-
return result.parsed;
|
29
|
-
}
|
30
|
-
|
31
|
-
// src/newman-exec.ts
|
32
|
-
import { run } from "newman";
|
33
|
-
import { readFile } from "fs";
|
34
|
-
async function executeCollection(options, env) {
|
35
|
-
const postmanCollection = await getPostmanCollection(options.source);
|
36
|
-
const postmanEnvironment = await getPostmanEnvironment(options.env);
|
37
|
-
return new Promise((resolve, reject) => {
|
38
|
-
run(__spreadValues({
|
39
|
-
collection: postmanCollection,
|
40
|
-
reporters: ["cli", "@field123/ep-resp"],
|
41
|
-
reporter: {
|
42
|
-
"@field123/ep-resp": __spreadValues({}, options)
|
43
|
-
},
|
44
|
-
environment: postmanEnvironment
|
45
|
-
}, env ? { envVar: createEnvironment(env) } : {}), (err) => {
|
46
|
-
if (err) {
|
47
|
-
reject(err);
|
48
|
-
}
|
49
|
-
console.log("collection run complete!");
|
50
|
-
resolve();
|
51
|
-
});
|
52
|
-
});
|
53
|
-
}
|
54
|
-
function createEnvironment(env) {
|
55
|
-
return [
|
56
|
-
{
|
57
|
-
key: "clientID",
|
58
|
-
value: env.EPCC_CLIENT_ID
|
59
|
-
},
|
60
|
-
{
|
61
|
-
key: "clientSecret",
|
62
|
-
value: env.EPCC_CLIENT_SECRET
|
63
|
-
}
|
64
|
-
];
|
65
|
-
}
|
66
|
-
function getPostmanEnvironment(source) {
|
67
|
-
console.log(`Attempting to load postman environment file from ${source}`);
|
68
|
-
return getFile(source);
|
69
|
-
}
|
70
|
-
function getPostmanCollection(source) {
|
71
|
-
console.log(`Attempting to load postman collection file from ${source}`);
|
72
|
-
return getFile(source);
|
73
|
-
}
|
74
|
-
function getFile(name) {
|
75
|
-
return new Promise((resolve, reject) => {
|
76
|
-
readFile(name, "utf-8", (err, data) => {
|
77
|
-
if (err) {
|
78
|
-
reject(err);
|
79
|
-
}
|
80
|
-
resolve(JSON.parse(data));
|
81
|
-
});
|
82
|
-
});
|
83
|
-
}
|
84
|
-
|
85
|
-
// src/terraform.ts
|
86
|
-
import { spawn } from "child_process";
|
87
|
-
function applyTerraform(options = { verbose: false }) {
|
88
|
-
console.log("Attempting to terraform apply...");
|
89
|
-
return handleTerraformCommand(options, "apply", "-auto-approve").then(() => console.log("Applied terraform successfully!"));
|
90
|
-
}
|
91
|
-
function destroyTerraform(options = { verbose: false }) {
|
92
|
-
console.log("Attempting to terraform destroy...");
|
93
|
-
return handleTerraformCommand(options, "destroy", "-auto-approve").then(() => console.log("Destroyed terraform successfully!"));
|
94
|
-
}
|
95
|
-
function handleTerraformCommand(options, ...args) {
|
96
|
-
return new Promise((resolve, reject) => {
|
97
|
-
try {
|
98
|
-
const child = spawn("terraform", args);
|
99
|
-
if (options.verbose) {
|
100
|
-
child.stdout.setEncoding("utf8");
|
101
|
-
child.stdout.on("data", (data) => {
|
102
|
-
console.log("stdout: " + data);
|
103
|
-
});
|
104
|
-
child.stderr.on("data", (data) => {
|
105
|
-
console.log("stderr: " + data);
|
106
|
-
});
|
107
|
-
}
|
108
|
-
child.on("close", (code) => {
|
109
|
-
if (code !== 0) {
|
110
|
-
return reject(`terraform running failed with ${code}`);
|
111
|
-
}
|
112
|
-
resolve();
|
113
|
-
});
|
114
|
-
} catch (error) {
|
115
|
-
console.log(`error inside terraform with args ${args}: `, error);
|
116
|
-
reject(error);
|
117
|
-
}
|
118
|
-
});
|
119
|
-
}
|
120
|
-
|
121
|
-
// src/cli.ts
|
122
|
-
function initiateCli() {
|
123
|
-
program.name("ep-resource-json");
|
124
|
-
program.command("endpoints").description("Used to fetch json response data from Elastic Path endpoints and output them into json files.").requiredOption("-s, --source <source>", "Source postman collection json file.").requiredOption("-e, --env <environment-file>", "Source postman environment json file.").option("-o, --output <output>", "Output location for the generated endpoint json files.", process.cwd()).option("-v, --verbose", "Logs details of terraform commands to console.", false).action(outputJsonResponesAction);
|
125
|
-
program.command("ter-destroy").description("Run terraform destroy in isolation.").action(isolatedTerraformDestroyAction);
|
126
|
-
program.parse(process.argv);
|
127
|
-
console.log("program: ", program.opts());
|
128
|
-
}
|
129
|
-
function outputJsonResponesAction(args) {
|
130
|
-
const env = loadEnv();
|
131
|
-
return applyTerraform({ verbose: args.verbose }).then(() => {
|
132
|
-
return executeCollection(args, env);
|
133
|
-
}).then(() => {
|
134
|
-
return destroyTerraform({ verbose: args.verbose });
|
135
|
-
}).catch((err) => {
|
136
|
-
destroyTerraform({ verbose: args.verbose });
|
137
|
-
console.error("error apply terraform: ", err);
|
138
|
-
});
|
139
|
-
}
|
140
|
-
function isolatedTerraformDestroyAction() {
|
141
|
-
loadEnv();
|
142
|
-
return destroyTerraform();
|
143
|
-
}
|
144
|
-
initiateCli();
|
145
|
-
//# sourceMappingURL=cli.mjs.map
|
package/dist/cli.mjs.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/cli.ts","../src/load-env.ts","../src/newman-exec.ts","../src/terraform.ts"],"sourcesContent":["import { program } from \"commander\";\nimport { loadEnv } from \"./load-env\";\nimport { executeCollection } from \"./newman-exec\";\nimport { applyTerraform, destroyTerraform } from \"./terraform\";\nimport { EndpointCliOptions } from \"./types\";\n\n/**\n * Checks if the script has been provided the required arguments.\n */\nfunction initiateCli(): void {\n program.name(\"ep-resource-json\");\n\n program\n .command(\"endpoints\")\n .description(\n \"Used to fetch json response data from Elastic Path endpoints and output them into json files.\"\n )\n .requiredOption(\n \"-s, --source <source>\",\n \"Source postman collection json file.\"\n )\n .requiredOption(\n \"-e, --env <environment-file>\",\n \"Source postman environment json file.\"\n )\n .option(\n \"-o, --output <output>\",\n \"Output location for the generated endpoint json files.\",\n process.cwd()\n )\n .option(\n \"-v, --verbose\",\n \"Logs details of terraform commands to console.\",\n false\n )\n .action(outputJsonResponesAction);\n\n program\n .command(\"ter-destroy\")\n .description(\"Run terraform destroy in isolation.\")\n .action(isolatedTerraformDestroyAction);\n\n program.parse(process.argv);\n\n // const { source } = program.opts<{ source: string }>();\n\n console.log(\"program: \", program.opts());\n}\nfunction outputJsonResponesAction(args: EndpointCliOptions): Promise<void> {\n const env = loadEnv();\n return applyTerraform({ verbose: args.verbose })\n .then(() => {\n return executeCollection(args, env);\n })\n .then(() => {\n return destroyTerraform({ verbose: args.verbose });\n })\n .catch((err) => {\n destroyTerraform({ verbose: args.verbose });\n console.error(\"error apply terraform: \", err);\n });\n}\n\nfunction isolatedTerraformDestroyAction(): Promise<void> {\n loadEnv();\n return destroyTerraform();\n}\n\ninitiateCli();\n","import { config as dotEnvConfig } from \"dotenv\";\nimport { EPEnv } from \"./types\";\n\nexport function loadEnv(): EPEnv {\n const result = dotEnvConfig();\n if (result.error) {\n throw new Error(\n \"Failed to load environment variables. Check .env exists and is setup to match example.\"\n );\n }\n // Casting parsed response.\n return result!.parsed as EPEnv;\n}\n","import { run } from \"newman\";\nimport { readFile } from \"fs\";\nimport type {\n CollectionDefinition,\n VariableScopeDefinition,\n} from \"postman-collection\";\nimport { EndpointCliOptions, EPEnv } from \"./types\";\n\nexport async function executeCollection(\n options: EndpointCliOptions,\n env?: EPEnv\n): Promise<void> {\n const postmanCollection = await getPostmanCollection(options.source);\n const postmanEnvironment = await getPostmanEnvironment(options.env);\n return new Promise((resolve, reject) => {\n run(\n {\n collection: postmanCollection,\n reporters: [\"cli\", \"@field123/ep-resp\"],\n reporter: {\n \"@field123/ep-resp\": {\n ...options,\n },\n },\n environment: postmanEnvironment,\n ...(env ? { envVar: createEnvironment(env) } : {}),\n },\n (err) => {\n if (err) {\n reject(err);\n }\n console.log(\"collection run complete!\");\n resolve();\n }\n );\n });\n}\n\nfunction createEnvironment(env: EPEnv): { key: string; value: string }[] {\n return [\n {\n key: \"clientID\",\n value: env.EPCC_CLIENT_ID,\n },\n {\n key: \"clientSecret\",\n value: env.EPCC_CLIENT_SECRET,\n },\n ];\n}\n\nfunction getPostmanEnvironment(\n source: string\n): Promise<VariableScopeDefinition> {\n console.log(`Attempting to load postman environment file from ${source}`);\n return getFile(source);\n}\n\nfunction getPostmanCollection(source: string): Promise<CollectionDefinition> {\n console.log(`Attempting to load postman collection file from ${source}`);\n return getFile(source);\n}\n\nfunction getFile(name: string): Promise<any> {\n return new Promise((resolve, reject) => {\n readFile(name, \"utf-8\", (err, data) => {\n if (err) {\n reject(err);\n }\n resolve(JSON.parse(data));\n });\n });\n}\n","import { spawn } from \"child_process\";\n\ninterface TerraformOptions {\n verbose: boolean;\n}\n\nexport function applyTerraform(\n options: TerraformOptions = { verbose: false }\n): Promise<void> {\n console.log(\"Attempting to terraform apply...\");\n return handleTerraformCommand(options, \"apply\", \"-auto-approve\").then(() =>\n console.log(\"Applied terraform successfully!\")\n );\n}\n\nexport function destroyTerraform(\n options: TerraformOptions = { verbose: false }\n): Promise<void> {\n console.log(\"Attempting to terraform destroy...\");\n return handleTerraformCommand(options, \"destroy\", \"-auto-approve\").then(() =>\n console.log(\"Destroyed terraform successfully!\")\n );\n}\n\nfunction handleTerraformCommand(\n options: TerraformOptions,\n ...args: string[]\n): Promise<void> {\n return new Promise((resolve, reject) => {\n try {\n const child = spawn(\"terraform\", args);\n\n if (options.verbose) {\n child.stdout.setEncoding(\"utf8\");\n child.stdout.on(\"data\", (data) => {\n console.log(\"stdout: \" + data);\n });\n child.stderr.on(\"data\", (data) => {\n console.log(\"stderr: \" + data);\n });\n }\n\n child.on(\"close\", (code) => {\n if (code !== 0) {\n return reject(`terraform running failed with ${code}`);\n }\n resolve();\n });\n } catch (error) {\n console.log(`error inside terraform with args ${args}: `, error);\n reject(error);\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;ACAA;AAGO,mBAA0B;AAC/B,QAAM,SAAS,aAAa;AAC5B,MAAI,OAAO,OAAO;AAChB,UAAM,IAAI,MACR,wFACF;AAAA,EACF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QAAM,MAAM,QAAQ;AACpB,SAAO,eAAe,EAAE,SAAS,KAAK,QAAQ,CAAC,EAC5C,KAAK,MAAM;AACV,WAAO,kBAAkB,MAAM,GAAG;AAAA,EACpC,CAAC,EACA,KAAK,MAAM;AACV,WAAO,iBAAiB,EAAE,SAAS,KAAK,QAAQ,CAAC;AAAA,EACnD,CAAC,EACA,MAAM,CAAC,QAAQ;AACd,qBAAiB,EAAE,SAAS,KAAK,QAAQ,CAAC;AAC1C,YAAQ,MAAM,2BAA2B,GAAG;AAAA,EAC9C,CAAC;AACL;AAEA,0CAAyD;AACvD,UAAQ;AACR,SAAO,iBAAiB;AAC1B;AAEA,YAAY;","names":[]}
|
package/dist/main.tf
DELETED
@@ -1,164 +0,0 @@
|
|
1
|
-
terraform {
|
2
|
-
required_providers {
|
3
|
-
epcc = {
|
4
|
-
source = "elasticpath/epcc"
|
5
|
-
version = "0.0.2"
|
6
|
-
}
|
7
|
-
}
|
8
|
-
}
|
9
|
-
|
10
|
-
provider "epcc" {
|
11
|
-
}
|
12
|
-
|
13
|
-
resource "epcc_hierarchy" "major_appliances" {
|
14
|
-
name = "Major Appliances"
|
15
|
-
description = "Free standing appliances"
|
16
|
-
slug = "Major-Appliances-MA0"
|
17
|
-
}
|
18
|
-
|
19
|
-
resource "epcc_node" "ranges" {
|
20
|
-
hierarchy_id = epcc_hierarchy.major_appliances.id
|
21
|
-
name = "Ranges"
|
22
|
-
description = "All stoves and ovens"
|
23
|
-
slug = "Ranges-MA1"
|
24
|
-
}
|
25
|
-
|
26
|
-
resource "epcc_node" "electric_ranges" {
|
27
|
-
hierarchy_id = epcc_hierarchy.major_appliances.id
|
28
|
-
parent_id = epcc_node.ranges.id
|
29
|
-
name = "Electric Ranges"
|
30
|
-
description = "Electric stoves and ovens"
|
31
|
-
slug = "Electric-Ranges-MA2"
|
32
|
-
}
|
33
|
-
|
34
|
-
resource "epcc_node" "gas_ranges" {
|
35
|
-
hierarchy_id = epcc_hierarchy.major_appliances.id
|
36
|
-
parent_id = epcc_node.ranges.id
|
37
|
-
name = "Gas Ranges"
|
38
|
-
description = "Gas stoves and ovens"
|
39
|
-
slug = "Ranges-MA2"
|
40
|
-
}
|
41
|
-
|
42
|
-
resource "epcc_product" "be_electric_range" {
|
43
|
-
name = "BestEver Electric Range"
|
44
|
-
sku = "BE-Electric-Range-1a1a"
|
45
|
-
slug = "bestever-range-1a1a"
|
46
|
-
description = "This electric model offers an induction heating element and convection oven."
|
47
|
-
status = "live"
|
48
|
-
commodity_type = "physical"
|
49
|
-
upc_ean = "111122223333"
|
50
|
-
mpn = "BE-R-1111-aaaa-1a1a"
|
51
|
-
}
|
52
|
-
|
53
|
-
resource "epcc_node_product" "electric_ranges_be_electric_range" {
|
54
|
-
hierarchy_id = epcc_hierarchy.major_appliances.id
|
55
|
-
node_id = epcc_node.electric_ranges.id
|
56
|
-
product_id = epcc_product.be_electric_range.id
|
57
|
-
}
|
58
|
-
|
59
|
-
resource "epcc_product" "be_gas_range" {
|
60
|
-
name = "BestEver Gas Range"
|
61
|
-
sku = "BE-Gas-Range-2b2b"
|
62
|
-
slug = "bestever-range-2b2b"
|
63
|
-
description = "This gas model includes a convection oven."
|
64
|
-
status = "live"
|
65
|
-
commodity_type = "physical"
|
66
|
-
upc_ean = "222233334444"
|
67
|
-
mpn = "BE-R-2222-bbbb-2b2b"
|
68
|
-
}
|
69
|
-
|
70
|
-
resource "epcc_node_product" "gas_ranges_bestever_gas_range" {
|
71
|
-
hierarchy_id = epcc_hierarchy.major_appliances.id
|
72
|
-
node_id = epcc_node.gas_ranges.id
|
73
|
-
product_id = epcc_product.be_gas_range.id
|
74
|
-
}
|
75
|
-
|
76
|
-
resource "epcc_currency" "british_pound_sterling" {
|
77
|
-
code = "GBP"
|
78
|
-
exchange_rate = 1
|
79
|
-
format = "£{price}"
|
80
|
-
decimal_point = "."
|
81
|
-
thousand_separator = ","
|
82
|
-
decimal_places = 2
|
83
|
-
default = false
|
84
|
-
enabled = true
|
85
|
-
}
|
86
|
-
|
87
|
-
resource "epcc_pricebook" "preferred_pricing" {
|
88
|
-
name = "Preferred Pricing"
|
89
|
-
description = "Catalog with pricing suitable for high-volume customers."
|
90
|
-
}
|
91
|
-
|
92
|
-
resource "epcc_product_price" "be_electric_range_price" {
|
93
|
-
currency {
|
94
|
-
code = "USD"
|
95
|
-
amount = 300000
|
96
|
-
includes_tax = false
|
97
|
-
}
|
98
|
-
currency {
|
99
|
-
code = epcc_currency.british_pound_sterling.code
|
100
|
-
amount = 250000
|
101
|
-
includes_tax = false
|
102
|
-
}
|
103
|
-
pricebook_id = epcc_pricebook.preferred_pricing.id
|
104
|
-
sku = epcc_product.be_electric_range.sku
|
105
|
-
}
|
106
|
-
|
107
|
-
resource "epcc_product_price" "be_gas_range_price" {
|
108
|
-
currency {
|
109
|
-
code = "USD"
|
110
|
-
amount = 350000
|
111
|
-
includes_tax = false
|
112
|
-
}
|
113
|
-
currency {
|
114
|
-
code = epcc_currency.british_pound_sterling.code
|
115
|
-
amount = 300000
|
116
|
-
includes_tax = false
|
117
|
-
}
|
118
|
-
pricebook_id = epcc_pricebook.preferred_pricing.id
|
119
|
-
sku = epcc_product.be_gas_range.sku
|
120
|
-
}
|
121
|
-
|
122
|
-
resource "epcc_catalog" "ranges_catalog" {
|
123
|
-
name = "Ranges Catalog"
|
124
|
-
description = "Catalog of Ranges"
|
125
|
-
hierarchies = [epcc_hierarchy.major_appliances.id]
|
126
|
-
pricebook = epcc_pricebook.preferred_pricing.id
|
127
|
-
}
|
128
|
-
|
129
|
-
resource "epcc_customer" "billy_bob" {
|
130
|
-
name = "Billy Bob"
|
131
|
-
email = "billybob@example.com"
|
132
|
-
}
|
133
|
-
|
134
|
-
resource "epcc_catalog_rule" "preferred_customer_pricing" {
|
135
|
-
name = "Preferred Customer Pricing"
|
136
|
-
description = "Preferred customer pricing"
|
137
|
-
catalog = epcc_catalog.ranges_catalog.id
|
138
|
-
customers = [epcc_customer.billy_bob.id]
|
139
|
-
}
|
140
|
-
|
141
|
-
output "epcc_hierarchy_id" {
|
142
|
-
value = epcc_hierarchy.major_appliances.id
|
143
|
-
}
|
144
|
-
|
145
|
-
output "epcc_product_id" {
|
146
|
-
value = epcc_product.be_electric_range.id
|
147
|
-
}
|
148
|
-
|
149
|
-
output "epcc_customer_id" {
|
150
|
-
value = epcc_customer.billy_bob.id
|
151
|
-
}
|
152
|
-
|
153
|
-
output "epcc_customer_email" {
|
154
|
-
value = epcc_customer.billy_bob.email
|
155
|
-
}
|
156
|
-
|
157
|
-
|
158
|
-
output "epcc_catalog_id" {
|
159
|
-
value = epcc_catalog.ranges_catalog.id
|
160
|
-
}
|
161
|
-
|
162
|
-
output "epcc_currency_id" {
|
163
|
-
value = epcc_currency.british_pound_sterling.id
|
164
|
-
}
|
package/dist/package.json
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "@field123/hacksprint-2022-js-sdk-test-response-generation",
|
3
|
-
"version": "0.0.1",
|
4
|
-
"main": "dist/cli.js",
|
5
|
-
"repository": "https://gitlab.elasticpath.com/Michelle.Wan/hacksprint-2022-js-sdk-test-response-generation.git",
|
6
|
-
"author": "Elastic Path",
|
7
|
-
"scripts": {
|
8
|
-
"postinstall": "terraform init && terraform get",
|
9
|
-
"build": "tsup && yarn build:copy:terra",
|
10
|
-
"build:copy:terra": "cp package.json dist/ && cp README.md dist/ && cp main.tf dist/",
|
11
|
-
"semantic-release": "semantic-release"
|
12
|
-
},
|
13
|
-
"files": [
|
14
|
-
"dist/"
|
15
|
-
],
|
16
|
-
"devDependencies": {
|
17
|
-
"@semantic-release/git": "^10.0.1",
|
18
|
-
"@semantic-release/gitlab": "^9.1.0",
|
19
|
-
"@semantic-release/npm": "^9.0.1",
|
20
|
-
"@types/node": "^17.0.23",
|
21
|
-
"semantic-release": "^19.0.2",
|
22
|
-
"tsup": "^5.12.4",
|
23
|
-
"typescript": "^4.6.3"
|
24
|
-
},
|
25
|
-
"dependencies": {
|
26
|
-
"@field123/newman-reporter-ep-resp": "^0.0.5",
|
27
|
-
"@jahed/terraform": "1.1.7",
|
28
|
-
"@types/newman": "^5.3.0",
|
29
|
-
"axios": "^0.26.1",
|
30
|
-
"commander": "^9.1.0",
|
31
|
-
"dotenv": "^16.0.0",
|
32
|
-
"newman": "^5.3.2"
|
33
|
-
},
|
34
|
-
"publishConfig": {
|
35
|
-
"access": "public"
|
36
|
-
},
|
37
|
-
"bin": {
|
38
|
-
"hacksprint-2022-js-sdk-test-response-generation": "dist/cli.js"
|
39
|
-
}
|
40
|
-
}
|