@contrail/cli 3.6.0-alpha-8-alpha.85a73d5 → 3.6.0-alpha.a5acc88

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.
Files changed (84) hide show
  1. package/README.md +26 -181
  2. package/dist/api/types.d.ts +0 -35
  3. package/dist/api/types.js +1 -49
  4. package/dist/auth/login.d.ts +4 -0
  5. package/dist/auth/login.js +115 -52
  6. package/dist/auth/login.spec.js +100 -0
  7. package/dist/auth/sso.d.ts +36 -0
  8. package/dist/auth/sso.js +174 -0
  9. package/dist/auth/sso.spec.js +148 -0
  10. package/dist/basecommand.js +2 -2
  11. package/dist/commands/app/getApiKey.js +2 -2
  12. package/dist/commands/login.d.ts +12 -0
  13. package/dist/commands/login.js +25 -0
  14. package/dist/common.d.ts +1 -4
  15. package/dist/common.js +1 -18
  16. package/dist/helpers/config/config.d.ts +3 -3
  17. package/dist/helpers/config/config.js +3 -3
  18. package/dist/helpers/file-helpers.d.ts +0 -1
  19. package/dist/helpers/file-helpers.js +3 -20
  20. package/dist/logger.js +1 -4
  21. package/node_modules/@contrail/entity-compare/package.json +3 -6
  22. package/node_modules/@contrail/loader/lib/common/conditional-columns.js +1 -1
  23. package/node_modules/@contrail/loader/lib/constants.d.ts +8 -0
  24. package/node_modules/@contrail/loader/lib/constants.js +9 -1
  25. package/node_modules/@contrail/loader/lib/entities-v2/linesheet-v2/item-processor.d.ts +4 -0
  26. package/node_modules/@contrail/loader/lib/entities-v2/linesheet-v2/item-processor.js +57 -0
  27. package/node_modules/@contrail/loader/lib/entities-v2/linesheet-v2/item-processor.spec.js +492 -34
  28. package/node_modules/@contrail/loader/lib/pipeline/validate.js +2 -52
  29. package/node_modules/@contrail/loader/lib/pipeline/validate.spec.js +0 -85
  30. package/node_modules/@contrail/loader/package.json +2 -2
  31. package/node_modules/@contrail/sdk/.github/workflows/publish-to-npm.yml +4 -1
  32. package/node_modules/@contrail/sdk/lib/auth/login.js +1 -1
  33. package/node_modules/@contrail/sdk/lib/config/config.d.ts +0 -3
  34. package/node_modules/@contrail/sdk/lib/config/config.js +7 -13
  35. package/node_modules/@contrail/sdk/lib/core/request.js +2 -6
  36. package/node_modules/@contrail/sdk/lib/entities/entities.client.d.ts +0 -2
  37. package/node_modules/@contrail/sdk/lib/entities/entities.client.js +1 -3
  38. package/node_modules/@contrail/sdk/lib/entities/entity.resource.registry.js +0 -1
  39. package/node_modules/@contrail/sdk/lib/index.d.ts +0 -1
  40. package/node_modules/@contrail/sdk/lib/index.js +0 -1
  41. package/node_modules/@contrail/sdk/package.json +1 -1
  42. package/oclif.manifest.json +50 -449
  43. package/package.json +12 -5
  44. package/dist/commands/entities/create.d.ts +0 -50
  45. package/dist/commands/entities/create.js +0 -633
  46. package/dist/commands/entities/create.spec.js +0 -583
  47. package/dist/commands/entities/delete.d.ts +0 -20
  48. package/dist/commands/entities/delete.js +0 -140
  49. package/dist/commands/entities/get.d.ts +0 -25
  50. package/dist/commands/entities/get.js +0 -269
  51. package/dist/commands/entities/grammar.spec.d.ts +0 -1
  52. package/dist/commands/entities/grammar.spec.js +0 -79
  53. package/dist/commands/entities/output.spec.d.ts +0 -1
  54. package/dist/commands/entities/output.spec.js +0 -72
  55. package/dist/commands/entities/update.d.ts +0 -32
  56. package/dist/commands/entities/update.js +0 -161
  57. package/dist/helpers/entities/assortment-items.d.ts +0 -11
  58. package/dist/helpers/entities/assortment-items.js +0 -76
  59. package/dist/helpers/entities/batchFetch.d.ts +0 -8
  60. package/dist/helpers/entities/batchFetch.js +0 -49
  61. package/dist/helpers/entities/index.d.ts +0 -3
  62. package/dist/helpers/entities/index.js +0 -6
  63. package/dist/helpers/entities/items.d.ts +0 -6
  64. package/dist/helpers/entities/items.js +0 -56
  65. package/dist/helpers/entities/items.spec.d.ts +0 -1
  66. package/dist/helpers/entities/items.spec.js +0 -19
  67. package/dist/helpers/entities/project-items.d.ts +0 -2
  68. package/dist/helpers/entities/project-items.js +0 -44
  69. package/dist/helpers/propertySpecifications/dateRanges.d.ts +0 -34
  70. package/dist/helpers/propertySpecifications/dateRanges.js +0 -83
  71. package/dist/helpers/propertySpecifications/dateRanges.spec.d.ts +0 -1
  72. package/dist/helpers/propertySpecifications/dateRanges.spec.js +0 -91
  73. package/dist/helpers/propertySpecifications/propertySpecifications.d.ts +0 -39
  74. package/dist/helpers/propertySpecifications/propertySpecifications.js +0 -102
  75. package/dist/helpers/propertySpecifications/propertySpecifications.spec.d.ts +0 -1
  76. package/dist/helpers/propertySpecifications/propertySpecifications.spec.js +0 -387
  77. package/dist/logger.spec.d.ts +0 -1
  78. package/dist/logger.spec.js +0 -12
  79. package/node_modules/@contrail/sdk/lib/image-search/image-search.d.ts +0 -34
  80. package/node_modules/@contrail/sdk/lib/image-search/image-search.js +0 -42
  81. package/node_modules/@contrail/sdk/lib/image-search/index.d.ts +0 -1
  82. package/node_modules/@contrail/sdk/lib/image-search/index.js +0 -17
  83. package/node_modules/@contrail/sdk/scripts/replicate-bug.js +0 -69
  84. /package/dist/{commands/entities/create.spec.d.ts → auth/sso.spec.d.ts} +0 -0
@@ -631,91 +631,6 @@ describe('validate', () => {
631
631
  expect(issue).toBeUndefined();
632
632
  });
633
633
  });
634
- describe('typePath format validation', () => {
635
- const itemConfig = {
636
- loadType: [types_1.LoadType.ITEM],
637
- federatedMappings: { itemFamilyFederatedId: 'itemFamilyFederatedId', name: 'name' },
638
- };
639
- it('should error when rows have an invalid typePath', async () => {
640
- const rows = [
641
- { itemFamilyFederatedId: 'fam-1', name: 'A', typePath: 'custom-entity:product' },
642
- { itemFamilyFederatedId: 'fam-2', name: 'B', typePath: 'item' },
643
- ];
644
- const result = await (0, validate_1.validate)(rows, itemConfig, makeAnalysis());
645
- const issue = result.issues.find((i) => i.columnName === 'typePath' && i.category === types_3.PreValidationCategory.MISSING_REQUIRED_FIELD);
646
- expect(issue).toBeDefined();
647
- expect(issue.affectedRows).toHaveLength(1);
648
- expect(issue.affectedRows[0].row).toBe(2);
649
- });
650
- it('should error when typePath is missing on rows', async () => {
651
- const rows = [
652
- { itemFamilyFederatedId: 'fam-1', name: 'A' },
653
- { itemFamilyFederatedId: 'fam-2', name: 'B' },
654
- ];
655
- const result = await (0, validate_1.validate)(rows, itemConfig, makeAnalysis());
656
- const issue = result.issues.find((i) => i.columnName === 'typePath' && i.category === types_3.PreValidationCategory.MISSING_REQUIRED_FIELD);
657
- expect(issue).toBeDefined();
658
- expect(issue.affectedRows).toHaveLength(2);
659
- });
660
- it('should not error when all rows have valid typePaths', async () => {
661
- const rows = [
662
- { itemFamilyFederatedId: 'fam-1', name: 'A', typePath: 'item' },
663
- { itemFamilyFederatedId: 'fam-2', name: 'B', typePath: 'item:product' },
664
- { itemFamilyFederatedId: 'fam-3', name: 'C', typePath: 'item:material:fabric' },
665
- ];
666
- const result = await (0, validate_1.validate)(rows, itemConfig, makeAnalysis());
667
- const issue = result.issues.find((i) => i.columnName === 'typePath' && i.category === types_3.PreValidationCategory.MISSING_REQUIRED_FIELD);
668
- expect(issue).toBeUndefined();
669
- });
670
- it('should not run for COLOR loads', async () => {
671
- const colorConfig = {
672
- loadType: [types_1.LoadType.COLOR],
673
- federatedMappings: { federatedId: 'federatedId', name: 'name' },
674
- };
675
- const rows = [{ federatedId: '1', name: 'Red', typePath: 'bad-value' }];
676
- const result = await (0, validate_1.validate)(rows, colorConfig, makeAnalysis());
677
- const issue = result.issues.find((i) => i.columnName === 'typePath' && i.category === types_3.PreValidationCategory.MISSING_REQUIRED_FIELD);
678
- expect(issue).toBeUndefined();
679
- });
680
- it('should not run for PROJECT_ITEM or ASSORTMENT loads (items already have a type)', async () => {
681
- const projectItemConfig = {
682
- loadType: [types_1.LoadType.PROJECT_ITEM, types_1.LoadType.ASSORTMENT],
683
- federatedMappings: { itemFamilyFederatedId: 'itemFamilyFederatedId', name: 'name' },
684
- };
685
- const rows = [{ itemFamilyFederatedId: 'fam-1', name: 'A' }];
686
- const result = await (0, validate_1.validate)(rows, projectItemConfig, makeAnalysis());
687
- const issue = result.issues.find((i) => i.columnName === 'typePath' && i.category === types_3.PreValidationCategory.MISSING_REQUIRED_FIELD);
688
- expect(issue).toBeUndefined();
689
- });
690
- it('should error for CUSTOM_ENTITY rows with missing subtype', async () => {
691
- const customEntityConfig = {
692
- loadType: [types_1.LoadType.CUSTOM_ENTITY],
693
- federatedMappings: { federatedId: 'federatedId', name: 'name' },
694
- };
695
- const rows = [
696
- { federatedId: '1', name: 'A', typePath: 'custom-entity:material' },
697
- { federatedId: '2', name: 'B', typePath: 'custom-entity:' },
698
- { federatedId: '3', name: 'C' },
699
- ];
700
- const result = await (0, validate_1.validate)(rows, customEntityConfig, makeAnalysis());
701
- const issue = result.issues.find((i) => i.columnName === 'typePath' && i.category === types_3.PreValidationCategory.MISSING_REQUIRED_FIELD);
702
- expect(issue).toBeDefined();
703
- expect(issue.affectedRows).toHaveLength(2);
704
- });
705
- it('should not error for CUSTOM_ENTITY rows with valid typePath', async () => {
706
- const customEntityConfig = {
707
- loadType: [types_1.LoadType.CUSTOM_ENTITY],
708
- federatedMappings: { federatedId: 'federatedId', name: 'name' },
709
- };
710
- const rows = [
711
- { federatedId: '1', name: 'A', typePath: 'custom-entity:material' },
712
- { federatedId: '2', name: 'B', typePath: 'custom-entity:material:fabric' },
713
- ];
714
- const result = await (0, validate_1.validate)(rows, customEntityConfig, makeAnalysis());
715
- const issue = result.issues.find((i) => i.columnName === 'typePath' && i.category === types_3.PreValidationCategory.MISSING_REQUIRED_FIELD);
716
- expect(issue).toBeUndefined();
717
- });
718
- });
719
634
  describe('typePath existence validation', () => {
720
635
  it('should error when typesByPath contains entries with errors (non-existent type)', async () => {
721
636
  const config = {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/loader",
3
- "version": "2.0.10",
3
+ "version": "2.0.9",
4
4
  "description": "Client library for helping with loader jobs.",
5
5
  "homepage": "https://archergreysorg.github.io/contrail-loader/",
6
6
  "main": "lib/index.js",
@@ -27,7 +27,7 @@
27
27
  "lib"
28
28
  ],
29
29
  "dependencies": {
30
- "@contrail/entity-compare": "^1.2.1",
30
+ "@contrail/entity-compare": "^1.0.5",
31
31
  "@contrail/entity-types": "1.6.1",
32
32
  "@contrail/policies": "^2.0.7",
33
33
  "@contrail/types": "^3.0.33",
@@ -3,8 +3,11 @@ name: Publish to NPM
3
3
  on:
4
4
  push:
5
5
  branches: [master]
6
+ paths-ignore:
7
+ - '.github/**'
6
8
  pull_request:
7
- branches: ['**']
9
+ paths-ignore:
10
+ - '.github/**'
8
11
 
9
12
  jobs:
10
13
  check-version:
@@ -15,7 +15,7 @@ const config_1 = require("../config");
15
15
  const auth_1 = require("./auth");
16
16
  const DEV_CONFIGURATION = {
17
17
  userPoolId: 'us-east-1_e2cA0nJWu',
18
- clientId: '209s9c62o165cqab0fu5ihjtu9',
18
+ clientId: 'nnio2uhtq7qfk1tjmi7tgg63p',
19
19
  apiGateway: 'https://api.dev.vibeiq.com/dev/api',
20
20
  };
21
21
  const PROD_CONFIGURATION = {
@@ -26,9 +26,6 @@ export interface ContrailConfig {
26
26
  errorHandler?: ErrorHandler;
27
27
  networkErrorHandler?: NetworkErrorHandler;
28
28
  }
29
- declare global {
30
- var __CONTRAIL_SDK_CONFIG__: ContrailConfig | undefined;
31
- }
32
29
  export declare const CONTRAIL_CONFIG: ContrailConfig;
33
30
  export declare function setConfig(config: ContrailConfig): void;
34
31
  export declare function getConfig(): ContrailConfig;
@@ -1,23 +1,17 @@
1
1
  "use strict";
2
+ var _a, _b;
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.getGlobalContext = exports.setGlobalContext = exports.setFromContext = exports.getConfig = exports.setConfig = exports.CONTRAIL_CONFIG = void 0;
4
- function getOrInitGlobalConfig() {
5
- var _a, _b;
6
- if (!globalThis.__CONTRAIL_SDK_CONFIG__) {
7
- globalThis.__CONTRAIL_SDK_CONFIG__ = {
8
- apiGateway: ((_a = process === null || process === void 0 ? void 0 : process.env) === null || _a === void 0 ? void 0 : _a.API_GATEWAY) || 'http://localhost:3000/api',
9
- orgId: (_b = process === null || process === void 0 ? void 0 : process.env) === null || _b === void 0 ? void 0 : _b.ORG_ID,
10
- };
11
- }
12
- return globalThis.__CONTRAIL_SDK_CONFIG__;
13
- }
14
- exports.CONTRAIL_CONFIG = getOrInitGlobalConfig();
5
+ exports.CONTRAIL_CONFIG = {
6
+ apiGateway: ((_a = process === null || process === void 0 ? void 0 : process.env) === null || _a === void 0 ? void 0 : _a.API_GATEWAY) || 'http://localhost:3000/api',
7
+ orgId: (_b = process === null || process === void 0 ? void 0 : process.env) === null || _b === void 0 ? void 0 : _b.ORG_ID,
8
+ };
15
9
  function setConfig(config) {
16
- Object.assign(getOrInitGlobalConfig(), config);
10
+ Object.assign(exports.CONTRAIL_CONFIG, config);
17
11
  }
18
12
  exports.setConfig = setConfig;
19
13
  function getConfig() {
20
- return getOrInitGlobalConfig();
14
+ return exports.CONTRAIL_CONFIG;
21
15
  }
22
16
  exports.getConfig = getConfig;
23
17
  function setFromContext(ctx) {
@@ -114,7 +114,7 @@ class Request {
114
114
  });
115
115
  }
116
116
  static requestWithRetries(resource, params, ctx) {
117
- var _a, _b;
117
+ var _a;
118
118
  return __awaiter(this, void 0, void 0, function* () {
119
119
  const userCtx = ctx || (0, config_1.getGlobalContext)();
120
120
  const start = new Date();
@@ -122,13 +122,12 @@ class Request {
122
122
  const url = API_GATEWAY + resource;
123
123
  const method = (params === null || params === void 0 ? void 0 : params.method) ? params.method.toUpperCase() : 'GET';
124
124
  const fullResource = `${method} ${url.split('/')[3]}${resource}`;
125
- const ignore404 = (_a = params === null || params === void 0 ? void 0 : params.ignore404) !== null && _a !== void 0 ? _a : false;
126
125
  let res;
127
126
  let attempt = 0;
128
127
  while (attempt <= this.MAX_RETRIES) {
129
128
  attempt++;
130
129
  try {
131
- if ((_b = userCtx === null || userCtx === void 0 ? void 0 : userCtx.requestOptions) === null || _b === void 0 ? void 0 : _b.useNativeFetch) {
130
+ if ((_a = userCtx === null || userCtx === void 0 ? void 0 : userCtx.requestOptions) === null || _a === void 0 ? void 0 : _a.useNativeFetch) {
132
131
  res = yield globalThis.fetch(url, params);
133
132
  }
134
133
  else {
@@ -161,9 +160,6 @@ class Request {
161
160
  else {
162
161
  const error = yield res.text();
163
162
  const errorJson = this.tryParseStringIntoObject(error);
164
- if (ignore404 && res.status === 404) {
165
- return null;
166
- }
167
163
  const isTokenExpired = errorJson && typeof errorJson === 'object' && errorJson.errorCode === 'TOKEN_EXPIRED';
168
164
  if (isTokenExpired) {
169
165
  throw new ApiError('Token expired', errorJson, 'TOKEN_EXPIRED');
@@ -37,7 +37,6 @@ export declare abstract class EntitiesClientGetOptions {
37
37
  suffix?: string;
38
38
  skipHydrateRelationships?: boolean;
39
39
  customParams?: Record<string, string | number | boolean>;
40
- ignore404?: boolean;
41
40
  }
42
41
  export declare abstract class EntitiesClientCreateOptions {
43
42
  entityName: string;
@@ -79,7 +78,6 @@ export declare abstract class EntitiesClientDeleteOptions {
79
78
  relationId?: string;
80
79
  apiVersion?: API_VERSION;
81
80
  suffix?: string;
82
- ignore404?: boolean;
83
81
  }
84
82
  export declare abstract class EntitiesClientBatchDeleteOptions {
85
83
  entityName?: string;
@@ -134,7 +134,7 @@ class Entities {
134
134
  resource += `ids=${options.federatedIds.map((id) => encodeURIComponent(id.replace(/,/g, '_COMMA_'))).join(',')}&`;
135
135
  }
136
136
  if (options.criteria) {
137
- resource += 'criteria=' + JSURL.stringify(options.criteria) + '&';
137
+ resource += 'criteria=' + JSURL.stringify(options.criteria);
138
138
  }
139
139
  if (options.customParams) {
140
140
  const buildQueryParam = (key, value) => {
@@ -154,7 +154,6 @@ class Entities {
154
154
  }
155
155
  return yield request_1.Request.request(resource, {
156
156
  headers: Object.assign({}, getVersionHeader((_a = options.apiVersion) !== null && _a !== void 0 ? _a : this.apiVersion)),
157
- ignore404: options.ignore404,
158
157
  }, this.ctx);
159
158
  });
160
159
  }
@@ -270,7 +269,6 @@ class Entities {
270
269
  return yield request_1.Request.request(resource, {
271
270
  method: 'DELETE',
272
271
  headers: Object.assign({ Accept: 'application/json', 'Content-Type': 'application/json' }, getVersionHeader((_a = options.apiVersion) !== null && _a !== void 0 ? _a : this.apiVersion)),
273
- ignore404: options.ignore404,
274
272
  }, this.ctx);
275
273
  });
276
274
  }
@@ -56,4 +56,3 @@ EntityResourceRegistry.registerEntityResourceName('project-configurator', 'proje
56
56
  EntityResourceRegistry.registerEntityResourceName('identity', 'identities');
57
57
  EntityResourceRegistry.registerEntityResourceName('entity-policy', 'entity-policies');
58
58
  EntityResourceRegistry.registerEntityResourceName('measurement-spec-entry', 'measurement-spec-entries');
59
- EntityResourceRegistry.registerEntityResourceName('image-search', 'image-search');
@@ -8,4 +8,3 @@ export * from './auth';
8
8
  export * from './policies';
9
9
  export * from './assets';
10
10
  export * from './notifications';
11
- export * from './image-search';
@@ -24,4 +24,3 @@ __exportStar(require("./auth"), exports);
24
24
  __exportStar(require("./policies"), exports);
25
25
  __exportStar(require("./assets"), exports);
26
26
  __exportStar(require("./notifications"), exports);
27
- __exportStar(require("./image-search"), exports);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/sdk",
3
- "version": "1.6.0",
3
+ "version": "1.5.13",
4
4
  "description": "Client library for interfacing with contrail services.",
5
5
  "homepage": "https://archergreysorg.github.io/contrail-lib/",
6
6
  "publishConfig": {