@contrail/cli 3.0.1 → 3.0.2-alpha.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.
package/README.md CHANGED
@@ -17,7 +17,7 @@ $ npm install -g @contrail/cli
17
17
  $ contrail COMMAND
18
18
  running command...
19
19
  $ contrail (--version)
20
- @contrail/cli/3.0.1 darwin-x64 node-v18.15.0
20
+ @contrail/cli/3.0.2-alpha.1 darwin-x64 node-v18.17.1
21
21
  $ contrail --help [COMMAND]
22
22
  USAGE
23
23
  $ contrail COMMAND
@@ -64,7 +64,7 @@ function loadOptionSets(fromDir) {
64
64
  function parseOptionSetValuesToString(optionSet) {
65
65
  return (0, lodash_1.cloneDeepWith)(optionSet, (value) => {
66
66
  // If the value is an object or array, let cloneDeepWith handle it
67
- if ((0, lodash_1.isObject)(value) || (0, lodash_1.isArray)(value)) {
67
+ if ((0, lodash_1.isObject)(value) || (0, lodash_1.isArray)(value) || typeof value === 'boolean') {
68
68
  return undefined;
69
69
  }
70
70
  // Otherwise, convert the value to string
@@ -74,6 +74,7 @@ function parseOptionSetValuesToString(optionSet) {
74
74
  exports.parseOptionSetValuesToString = parseOptionSetValuesToString;
75
75
  async function uploadOS(dir) {
76
76
  const optionSets = loadOptionSets(dir);
77
+ validateOptionSets(optionSets);
77
78
  const currentOptionSets = await new sdk_1.Entities().get({
78
79
  entityName: 'type-property-option-set',
79
80
  });
@@ -126,6 +127,18 @@ async function uploadOS(dir) {
126
127
  logger_1.default.error(`Error Uploading OptionSets: ${err}`);
127
128
  }
128
129
  }
130
+ function validateOptionSets(optionSets) {
131
+ optionSets.forEach((optionSet) => {
132
+ optionSet.optionSet.forEach((option) => {
133
+ validateOption(option, optionSet.slug);
134
+ });
135
+ });
136
+ }
137
+ function validateOption(option, slug) {
138
+ if (typeof option.disabled !== 'boolean') {
139
+ throw new Error(`Invalid type for "disabled" property: expected a boolean but received "${typeof option.disabled}" for Option Set with slug "${slug}" and value "${option.value}".`);
140
+ }
141
+ }
129
142
  // for (const currentOptionSet of currentOptionSets) {
130
143
  // try {
131
144
  // const found = newOptionSetsBySlug[currentOptionSet.slug];
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const uploadOptionSets_1 = require("../../commands/types/uploadOptionSets");
4
4
  describe('parseOptionSetValuesToString', () => {
5
- it('should convert all option set values to strings', () => {
5
+ it('should convert all option set values to strings except for booleans', () => {
6
6
  const input = {
7
7
  value1: 123,
8
8
  value2: true,
@@ -10,7 +10,7 @@ describe('parseOptionSetValuesToString', () => {
10
10
  };
11
11
  const expectedOutput = {
12
12
  value1: '123',
13
- value2: 'true',
13
+ value2: true,
14
14
  value3: { nested: 'object' },
15
15
  };
16
16
  const result = (0, uploadOptionSets_1.parseOptionSetValuesToString)(input);
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.0.1",
2
+ "version": "3.0.2-alpha.1",
3
3
  "commands": {
4
4
  "app:create": {
5
5
  "id": "app:create",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/cli",
3
- "version": "3.0.1",
3
+ "version": "3.0.2-alpha.1",
4
4
  "description": "VibeIQ's Contrail Platform CLI.",
5
5
  "bin": {
6
6
  "contrail-cli": "./bin/run",
@@ -23,7 +23,7 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "@contrail/entity-types": "^1.1.17",
26
- "@contrail/org-config-migration": "^1.0.3",
26
+ "@contrail/org-config-migration": "1.1.1-alpha.1",
27
27
  "@contrail/sdk": "^1.4.6",
28
28
  "@contrail/types": "^3.0.48",
29
29
  "@contrail/util": "^1.0.41",