@contrail/cli 3.6.0-alpha-8-alpha.e2d1830 → 3.6.0-alpha-8-alpha.7830b8a

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.6.0-alpha-8-alpha.e2d1830 linux-x64 node-v24.22.2
20
+ @contrail/cli/3.6.0-alpha-8-alpha.7830b8a linux-x64 node-v24.22.2
21
21
  $ contrail --help [COMMAND]
22
22
  USAGE
23
23
  $ contrail COMMAND
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const fs_1 = tslib_1.__importDefault(require("fs"));
5
5
  const core_1 = require("@oclif/core");
6
- const types_1 = require("../../api/types");
6
+ const types_1 = require("@contrail/types");
7
+ const types_2 = require("../../api/types");
7
8
  const propertyValues_1 = require("../../helpers/propertySpecifications/propertyValues");
8
9
  const basecommand_1 = require("../../basecommand");
9
10
  const sdk_1 = require("@contrail/sdk");
@@ -205,10 +206,14 @@ async function getEntitiesByName(entityName, propertySpec, typePropertySets, opt
205
206
  });
206
207
  }
207
208
  function convertPropertySpecIntoCriteria(propertySpec, typePropertySets = []) {
209
+ const propertyTypeBySlug = (0, propertyValues_1.buildPropertyTypeMap)(typePropertySets);
208
210
  const ranges = new Map();
209
211
  const values = new Map();
210
212
  propertySpec.forEach((value, slug) => {
211
- ((0, dateRanges_1.isDateRangeValue)(value) ? ranges : values).set(slug, value);
213
+ const looksLikeRange = typeof value === 'string' && value.includes('..');
214
+ const isDateProperty = propertyTypeBySlug.get(slug) === types_1.PropertyType.Date;
215
+ const isRange = looksLikeRange && (isDateProperty || (0, dateRanges_1.isDateRangeValue)(value));
216
+ (isRange ? ranges : values).set(slug, value);
212
217
  });
213
218
  const criteria = (0, propertyValues_1.castCriteriaValues)(values, typePropertySets);
214
219
  ranges.forEach((value, slug) => {
@@ -224,7 +229,7 @@ function convertPropertySpecIntoCriteria(propertySpec, typePropertySets = []) {
224
229
  async function resolveQueryTypes(entityName, propertySpec) {
225
230
  const specified = propertySpec.get('typePath');
226
231
  const paths = specified === undefined ? [entityName] : [specified].flat().map(String);
227
- const types = await Promise.all(paths.map((path) => (0, types_1.getTypeByPath)(path).catch(() => {
232
+ const types = await Promise.all(paths.map((path) => (0, types_2.getTypeByPath)(path).catch(() => {
228
233
  console.error(`Could not resolve type ${path}; criteria on it are read as written.`);
229
234
  return undefined;
230
235
  })));
@@ -37,7 +37,11 @@ function castValueToPropertyType(value, propertyType, propertySlug) {
37
37
  }
38
38
  return numValue;
39
39
  case types_1.PropertyType.Date:
40
- return new Date(value.toString()).toISOString();
40
+ const date = new Date(value.toString());
41
+ if (isNaN(date.getTime())) {
42
+ throw new Error(`Invalid date value for ${propertySlug}: ${value}`);
43
+ }
44
+ return date.toISOString();
41
45
  case types_1.PropertyType.MultiSelect:
42
46
  if (Array.isArray(value)) {
43
47
  return value;
@@ -146,3 +146,11 @@ describe('castValuesToPropertyTypes never guesses', () => {
146
146
  });
147
147
  });
148
148
  });
149
+ describe('Date casting', () => {
150
+ it('names the slug and value for an unparseable date', () => {
151
+ expect(() => (0, propertyValues_1.castValueToPropertyType)('garbage', types_1.PropertyType.Date, 'createdOn')).toThrow('Invalid date value for createdOn: garbage');
152
+ });
153
+ it('still converts a parseable date', () => {
154
+ expect((0, propertyValues_1.castValueToPropertyType)('2025-09-15', types_1.PropertyType.Date, 'createdOn')).toBe('2025-09-15T00:00:00.000Z');
155
+ });
156
+ });
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.6.0-alpha-8-alpha.e2d1830",
2
+ "version": "3.6.0-alpha-8-alpha.7830b8a",
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.6.0-alpha-8-alpha.e2d1830",
3
+ "version": "3.6.0-alpha-8-alpha.7830b8a",
4
4
  "description": "VibeIQ's Contrail Platform CLI.",
5
5
  "bin": {
6
6
  "contrail-cli": "./bin/run",