maro-plugin-http 1.1.0 → 1.1.1

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: ["http.collection"] }).run();
14
- const collection = new maro_1.Dir(config.get("http.collection"));
13
+ await new maro_1.ValidateConfig({ keys: ["paths.http_collection"] }).run();
14
+ const collection = (0, maro_1.getPath)("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,6 +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("http_collection", "Directory containing HTTP collection files");
11
12
  maro_1.ConfigRegistry.register(new config_1.HttpConfig());
12
13
  if (maro_1.Config.getView().get("http.generate_swagger"))
13
14
  new generate_swagger_1.GenerateSwagger().register();
@@ -3,7 +3,6 @@ export declare class HttpConfig implements ConfigSection {
3
3
  key: string;
4
4
  validate(config: unknown): {
5
5
  url_suffix?: string | undefined;
6
- collection?: string | undefined;
7
6
  postman_dir?: string | undefined;
8
7
  generate_swagger?: boolean | undefined;
9
8
  };
@@ -7,7 +7,6 @@ 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(),
11
10
  postman_dir: v4_1.default.string().optional(),
12
11
  generate_swagger: v4_1.default.boolean().optional()
13
12
  });
@@ -23,7 +22,6 @@ class HttpConfig {
23
22
  help() {
24
23
  return [
25
24
  { 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" },
27
25
  { key: "postman_dir", description: "Directory to save postman files relative to 'collection'", type: "string" },
28
26
  { key: "generate_swagger", description: "Generate swagger on every AppRepo mr", type: "boolean" }
29
27
  ];
@@ -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
- 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();
9
+ await new maro_1.ValidateConfig({ keys: ["paths.http_collection"] }).run();
10
+ const collection = (0, maro_1.getPath)("http_collection");
11
+ const collections = 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,9 +5,8 @@ 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: ["http.collection"] }).run();
9
- const config = maro_1.Config.getView();
10
- const collection = new maro_1.Dir(config.get("http.collection"));
8
+ await new maro_1.ValidateConfig({ keys: ["paths.http_collection"] }).run();
9
+ const collection = (0, maro_1.getPath)("http_collection");
11
10
  const collections = collection.readFiles();
12
11
  const files = collections.map((n) => new http_file_1.HttpFile(n.path));
13
12
  const http_file = await ctx.ui.promptChoice(files);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maro-plugin-http",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "main": "./dist/src/lib/index.js",
5
5
  "types": "./dist/src/lib/index.d.ts",
6
6
  "type": "commonjs",
@@ -10,8 +10,7 @@
10
10
  "scripts": {
11
11
  "build": "tsc --project ./tsconfig.json",
12
12
  "start": "node ./dist/src/index.js",
13
- "clean": "rm -rf node_modules package-lock.json",
14
- "import": "npm run clean; cp ../../maro/maro-2.0.0.tgz ./maro-2.0.0.tgz; npm install"
13
+ "clean": "rm -rf node_modules package-lock.json"
15
14
  },
16
15
  "maro": {
17
16
  "plugin": "./dist/src/index.js"