@mablhq/mabl-cli 2.2.2 → 2.4.0

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.
@@ -32,7 +32,8 @@ exports.builder = (yargs) => {
32
32
  type: 'string',
33
33
  })
34
34
  .option(constants_1.CommandArgFromPlanId, {
35
- describe: 'The plan id to get a list of tests from. The environment id and the credentials id will be used as well unless supplied',
35
+ describe: `The plan id to get a list of tests from.
36
+ Note: running tests with the --from-plan-id option is not a plan run. Advanced plan configurations, such as stages, browser settings or shared variables, are not applied.`,
36
37
  type: 'string',
37
38
  })
38
39
  .option(constants_1.CommandArgMablBranch, {
@@ -64,7 +65,8 @@ exports.builder = (yargs) => {
64
65
  })
65
66
  .option(constants_1.CommandArgEnvironmentId, {
66
67
  alias: constants_1.CommandArgAliases.EnvironmentId,
67
- describe: 'Mabl environment to run under. Specify to ensure the test runs with environment variables and the latest find information.',
68
+ describe: `Mabl environment to run under. Specify to ensure the test runs with environment variables and the latest find information.
69
+ Note: Setting the environment does not override the default URL. Please use the (—url) command to override the URL.`,
68
70
  nargs: 1,
69
71
  type: 'string',
70
72
  })
@@ -3,8 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.isJson = exports.isFolder = exports.validateCollectionFeatures = exports.generateRawScriptField = exports.processPostmanItems = exports.createEmptyRequest = exports.createEmptyRequestEventArray = exports.splitLines = exports.PRE_REQUEST_LISTEN = exports.insertMablAssertionScripts = exports.toPostmanScript = exports.replaceVariables = exports.getActualValue = exports.readBody = exports.getResponseContentType = exports.valueToUnquotedString = exports.humanizeAssertion = exports.getAssertionTargetArgument = exports.assertionHasTest = exports.isValidMablAssertion = exports.normalizeExpectedValue = exports.assertionRequiresValue = exports.filterValidMablAssertions = exports.filterValidMablVariableAssignments = exports.isValidMablVariableAssignment = exports.removeMablGeneratedScripts = exports.createEmptyRequestEvent = exports.findFirstMatchingEvent = exports.restoreCustomRequestFields = exports.deduplicateApiTestExecutionResults = exports.createEmptyVariable = exports.createEmptyAssertion = exports.humanizeAssertionType = exports.getAssertionTypesForTarget = exports.caseInsensitiveEquals = exports.compareStringsCaseInsensitive = exports.ASSERT_TYPES = exports.ASSERT_TARGETS = exports.COLLECTION_WITH_FOLDERS_ERROR = exports.HMAC_SHA1_SIGNATURE = exports.DEFAULT_ADD_OAUTH1_TO_HEADER_VALUE = exports.DEFAULT_OAUTH1_VERSION = exports.OAUTH1_AUTH = exports.NO_AUTH = exports.BEARER_TOKEN_AUTH = exports.BASIC_AUTH = exports.API_KEY_AUTH = exports.INHERIT_AUTH_FROM_PARENT_VALUE = exports.MABL_GENERATED_ASSERTION_TOKEN = exports.TEST_LISTEN = void 0;
7
- exports.processPostmanItem = exports.replaceRawScriptWithExecArray = exports.removeInvalidHeaders = exports.processItemAuth = exports.mablAuthToPostman = exports.formatContent = exports.getRequestMode = exports.getFormDataArray = exports.isText = exports.isXML = void 0;
6
+ exports.isItemGroupDefinition = exports.isFolder = exports.validateCollectionFeaturesForApiTestEditor = exports.generateRawScriptField = exports.processPostmanItems = exports.createEmptyRequest = exports.createEmptyRequestEventArray = exports.splitLines = exports.PRE_REQUEST_LISTEN = exports.insertMablAssertionScripts = exports.toPostmanScript = exports.replaceVariables = exports.getActualValue = exports.readBody = exports.getResponseContentType = exports.valueToUnquotedString = exports.humanizeAssertion = exports.getAssertionTargetArgument = exports.assertionHasTest = exports.isValidMablAssertion = exports.normalizeExpectedValue = exports.assertionRequiresValue = exports.filterValidMablAssertions = exports.filterValidMablVariableAssignments = exports.isValidMablVariableAssignment = exports.removeMablGeneratedScripts = exports.createEmptyRequestEvent = exports.findFirstMatchingEvent = exports.restoreCustomRequestFields = exports.deduplicateApiTestExecutionResults = exports.createEmptyVariable = exports.createEmptyAssertion = exports.humanizeAssertionType = exports.getAssertionTypesForTarget = exports.caseInsensitiveEquals = exports.compareStringsCaseInsensitive = exports.ASSERT_TYPES = exports.ASSERT_TARGETS = exports.COLLECTION_WITH_FOLDERS_ERROR = exports.HMAC_SHA1_SIGNATURE = exports.DEFAULT_ADD_OAUTH1_TO_HEADER_VALUE = exports.DEFAULT_OAUTH1_VERSION = exports.OAUTH1_AUTH = exports.NO_AUTH = exports.BEARER_TOKEN_AUTH = exports.BASIC_AUTH = exports.API_KEY_AUTH = exports.INHERIT_AUTH_FROM_PARENT_VALUE = exports.MABL_GENERATED_ASSERTION_TOKEN = exports.TEST_LISTEN = void 0;
7
+ exports.processPostmanItem = exports.replaceRawScriptWithExecArray = exports.removeInvalidHeaders = exports.processItemAuth = exports.mablAuthToPostman = exports.formatContent = exports.getRequestMode = exports.getFormDataArray = exports.isText = exports.isXML = exports.isJson = exports.isSupportedAuthType = exports.isItemDefinition = exports.isCollectionDefinition = void 0;
8
8
  const newman_types_1 = require("./newman-types");
9
9
  const lodash_1 = __importDefault(require("lodash"));
10
10
  const uuid_1 = require("uuid");
@@ -601,15 +601,12 @@ const createEmptyRequest = (id = (0, uuid_1.v4)()) => ({
601
601
  exports.createEmptyRequest = createEmptyRequest;
602
602
  function processPostmanItems(items, handleItem, handleFolder) {
603
603
  lodash_1.default.forEach(items, (item) => {
604
- const maybeItemGroup = item;
605
- if (isFolder(maybeItemGroup)) {
606
- if (handleFolder) {
607
- handleFolder(maybeItemGroup);
608
- }
609
- processPostmanItems(maybeItemGroup.item, handleItem);
604
+ if (isItemGroupDefinition(item)) {
605
+ handleFolder === null || handleFolder === void 0 ? void 0 : handleFolder(item);
606
+ processPostmanItems(item.item, handleItem, handleFolder);
610
607
  }
611
608
  else {
612
- handleItem(item);
609
+ handleItem === null || handleItem === void 0 ? void 0 : handleItem(item);
613
610
  }
614
611
  });
615
612
  }
@@ -620,7 +617,7 @@ function generateRawScriptField(eventValue) {
620
617
  }
621
618
  }
622
619
  exports.generateRawScriptField = generateRawScriptField;
623
- function validateCollectionFeatures(collection) {
620
+ function validateCollectionFeaturesForApiTestEditor(collection) {
624
621
  let hasFolders = false;
625
622
  const handleFolder = (_item) => {
626
623
  hasFolders = true;
@@ -631,11 +628,30 @@ function validateCollectionFeatures(collection) {
631
628
  }
632
629
  return undefined;
633
630
  }
634
- exports.validateCollectionFeatures = validateCollectionFeatures;
631
+ exports.validateCollectionFeaturesForApiTestEditor = validateCollectionFeaturesForApiTestEditor;
635
632
  function isFolder(item) {
636
633
  return 'item' in item && !!item.item;
637
634
  }
638
635
  exports.isFolder = isFolder;
636
+ function isItemGroupDefinition(item) {
637
+ return isFolder(item) && !isCollectionDefinition(item);
638
+ }
639
+ exports.isItemGroupDefinition = isItemGroupDefinition;
640
+ function isCollectionDefinition(item) {
641
+ return isFolder(item) && 'info' in item;
642
+ }
643
+ exports.isCollectionDefinition = isCollectionDefinition;
644
+ function isItemDefinition(item) {
645
+ return !isFolder(item);
646
+ }
647
+ exports.isItemDefinition = isItemDefinition;
648
+ function isSupportedAuthType(authDefinition) {
649
+ if (!authDefinition.type) {
650
+ return false;
651
+ }
652
+ return (newman_types_1.MablSupportedPostmanAuthTypes.includes(authDefinition.type) || authDefinition.type === 'noauth');
653
+ }
654
+ exports.isSupportedAuthType = isSupportedAuthType;
639
655
  function isJson(contentType) {
640
656
  return (!!contentType &&
641
657
  (contentType.startsWith('application/json') ||
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BodyMode = exports.AssertionType = exports.AssertionTarget = void 0;
3
+ exports.BodyMode = exports.MablSupportedPostmanAuthTypes = exports.AssertionType = exports.AssertionTarget = void 0;
4
4
  var AssertionTarget;
5
5
  (function (AssertionTarget) {
6
6
  AssertionTarget["Header"] = "Header";
@@ -17,6 +17,12 @@ var AssertionType;
17
17
  AssertionType["NotPresent"] = "NotPresent";
18
18
  AssertionType["Present"] = "Present";
19
19
  })(AssertionType = exports.AssertionType || (exports.AssertionType = {}));
20
+ exports.MablSupportedPostmanAuthTypes = [
21
+ 'apikey',
22
+ 'basic',
23
+ 'bearer',
24
+ 'oauth1',
25
+ ];
20
26
  var BodyMode;
21
27
  (function (BodyMode) {
22
28
  BodyMode["file"] = "file";