maro-plugin-http 1.1.1 → 1.1.2
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.
|
@@ -10,8 +10,8 @@ exports.PostmanCommand = {
|
|
|
10
10
|
description: "Generate postman from http files",
|
|
11
11
|
run: async ({ ctx, config }) => {
|
|
12
12
|
const log = ctx.logger;
|
|
13
|
-
await new maro_1.ValidateConfig({ keys: ["
|
|
14
|
-
const collection =
|
|
13
|
+
await new maro_1.ValidateConfig({ keys: ["http.collection"] }).run();
|
|
14
|
+
const collection = new maro_1.Dir(config.get("http.collection"));
|
|
15
15
|
const collections = collection.readFiles();
|
|
16
16
|
const files = collections.map((n) => new http_file_1.HttpFile(n.path));
|
|
17
17
|
const postman = new postman_1.Postman();
|
package/dist/src/index.js
CHANGED
|
@@ -8,7 +8,7 @@ const config_1 = require("./lib/config");
|
|
|
8
8
|
const Plugin = {
|
|
9
9
|
name: "maro-plugin-http",
|
|
10
10
|
onLoad() {
|
|
11
|
-
maro_1.PathRegistry.register("
|
|
11
|
+
maro_1.PathRegistry.register("http", "Repository containing HTTP collection files");
|
|
12
12
|
maro_1.ConfigRegistry.register(new config_1.HttpConfig());
|
|
13
13
|
if (maro_1.Config.getView().get("http.generate_swagger"))
|
|
14
14
|
new generate_swagger_1.GenerateSwagger().register();
|
package/dist/src/lib/config.d.ts
CHANGED
package/dist/src/lib/config.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.HttpConfig = void 0;
|
|
|
7
7
|
const v4_1 = __importDefault(require("zod/v4"));
|
|
8
8
|
const schema = v4_1.default.object({
|
|
9
9
|
url_suffix: v4_1.default.string().optional(),
|
|
10
|
+
collection: v4_1.default.string().optional(),
|
|
10
11
|
postman_dir: v4_1.default.string().optional(),
|
|
11
12
|
generate_swagger: v4_1.default.boolean().optional()
|
|
12
13
|
});
|
|
@@ -22,6 +23,7 @@ class HttpConfig {
|
|
|
22
23
|
help() {
|
|
23
24
|
return [
|
|
24
25
|
{ key: "url_suffix", description: "Suffix used to extract service name from host variable", type: "string" },
|
|
26
|
+
{ key: "collection", description: "Directory containing HTTP collection files", type: "string" },
|
|
25
27
|
{ key: "postman_dir", description: "Directory to save postman files relative to 'collection'", type: "string" },
|
|
26
28
|
{ key: "generate_swagger", description: "Generate swagger on every AppRepo mr", type: "boolean" }
|
|
27
29
|
];
|
|
@@ -6,9 +6,9 @@ const http_file_1 = require("../lib/http_file");
|
|
|
6
6
|
class GetHttpFile extends maro_1.WorkflowStep {
|
|
7
7
|
async run(ctx, { app_repo }) {
|
|
8
8
|
const log = ctx.logger;
|
|
9
|
-
|
|
10
|
-
const collection =
|
|
11
|
-
const collections = collection.readFiles();
|
|
9
|
+
new maro_1.ValidateConfig({ keys: ["http.collection"] }).run();
|
|
10
|
+
const collection = maro_1.Config.getView().get("http.collection");
|
|
11
|
+
const collections = new maro_1.Dir(collection).readFiles();
|
|
12
12
|
const files = collections.map((n) => new http_file_1.HttpFile(n.path));
|
|
13
13
|
const { name } = await app_repo.getInfo();
|
|
14
14
|
const http_file = files.find((f) => f.service === name);
|
|
@@ -5,8 +5,9 @@ const maro_1 = require("@maro/maro");
|
|
|
5
5
|
const http_file_1 = require("../lib/http_file");
|
|
6
6
|
class PromptHttpFile extends maro_1.WorkflowStep {
|
|
7
7
|
async run(ctx) {
|
|
8
|
-
await new maro_1.ValidateConfig({ keys: ["
|
|
9
|
-
const
|
|
8
|
+
await new maro_1.ValidateConfig({ keys: ["http.collection"] }).run();
|
|
9
|
+
const config = maro_1.Config.getView();
|
|
10
|
+
const collection = new maro_1.Dir(config.get("http.collection"));
|
|
10
11
|
const collections = collection.readFiles();
|
|
11
12
|
const files = collections.map((n) => new http_file_1.HttpFile(n.path));
|
|
12
13
|
const http_file = await ctx.ui.promptChoice(files);
|