@contrail/cli 3.5.5-alpha.bd66bf6 → 3.5.5-alpha.c95b563

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.5.5-alpha.bd66bf6 linux-x64 node-v24.22.1
20
+ @contrail/cli/3.5.5-alpha.c95b563 linux-x64 node-v24.21.0
21
21
  $ contrail --help [COMMAND]
22
22
  USAGE
23
23
  $ contrail COMMAND
@@ -81,7 +81,6 @@ async function authenticateWithUsernamePassword(config) {
81
81
  const apiGateway = config?.apiGateway ?? DEFAULT_API_GATEWAY;
82
82
  const cognitoConfig = getCognitoConfig(apiGateway);
83
83
  const environment = describeEnvironment(apiGateway);
84
- logger_1.default.info(`Signing in to ${environment} — use your ${environment} VibeIQ credentials.`);
85
84
  const questions = [];
86
85
  if (!process.env.CONTRAIL_CLI_EMAIL) {
87
86
  questions.push({
@@ -135,6 +134,10 @@ async function authenticateWithUsernamePassword(config) {
135
134
  }
136
135
  },
137
136
  onFailure: (err) => {
137
+ if (err?.code === 'ResourceNotFoundException') {
138
+ reject(new Error(`This version of the CLI signs in to ${environment} with a Cognito client that no longer exists. Update the CLI: npm i -g @contrail/cli`));
139
+ return;
140
+ }
138
141
  reject(err);
139
142
  },
140
143
  });
@@ -4,11 +4,12 @@ const amazon_cognito_identity_js_1 = require("amazon-cognito-identity-js");
4
4
  const sdk_1 = require("@contrail/sdk");
5
5
  const config_1 = require("../helpers/config/config");
6
6
  const login_1 = require("./login");
7
+ const mockAuthenticateUser = jest.fn();
7
8
  jest.mock('amazon-cognito-identity-js', () => ({
8
9
  CognitoUserPool: jest.fn(),
9
10
  AuthenticationDetails: jest.fn(),
10
11
  CognitoUser: jest.fn().mockImplementation(() => ({
11
- authenticateUser: (_details, callbacks) => callbacks.onSuccess({ idToken: { jwtToken: 'cognito-id-token' } }),
12
+ authenticateUser: (details, callbacks) => mockAuthenticateUser(details, callbacks),
12
13
  })),
13
14
  }));
14
15
  jest.mock('@contrail/sdk', () => ({
@@ -40,6 +41,7 @@ describe('authUser with email and password', () => {
40
41
  process.env.CONTRAIL_CLI_PASSWORD = 'secret';
41
42
  config_1.getConfig.mockResolvedValue({ apiGateway: DEV_GATEWAY, orgSlug: 'adam-zone-1' });
42
43
  sdk_1.getCurrentUser.mockResolvedValue({ id: 'user-1' });
44
+ mockAuthenticateUser.mockImplementation((_details, callbacks) => callbacks.onSuccess({ idToken: { jwtToken: 'cognito-id-token' } }));
43
45
  fetchMock = jest.fn();
44
46
  global.fetch = fetchMock;
45
47
  });
@@ -82,6 +84,14 @@ describe('authUser with email and password', () => {
82
84
  await expect((0, login_1.authUser)()).rejects.toThrow('No Cognito user pool is known for localhost:3000.');
83
85
  expect(config_1.storeConfig).not.toHaveBeenCalled();
84
86
  });
87
+ it('should tell the user to update the CLI when its Cognito client no longer exists', async () => {
88
+ mockAuthenticateUser.mockImplementation((_details, callbacks) => callbacks.onFailure({
89
+ code: 'ResourceNotFoundException',
90
+ message: 'User pool client 209s9c62o165cqab0fu5ihjtu9 does not exist.',
91
+ }));
92
+ await expect((0, login_1.authUser)()).rejects.toThrow('This version of the CLI signs in to dev with a Cognito client that no longer exists. Update the CLI: npm i -g @contrail/cli');
93
+ expect(config_1.storeConfig).not.toHaveBeenCalled();
94
+ });
85
95
  it('should fail without saving tokens when the environment rejects the sign-in', async () => {
86
96
  fetchMock.mockResolvedValueOnce(jsonResponse(401, { message: 'Unauthorized' }));
87
97
  await expect((0, login_1.authUser)()).rejects.toThrow('dev rejected the sign-in (401).');
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.5.5-alpha.bd66bf6",
2
+ "version": "3.5.5-alpha.c95b563",
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.5.5-alpha.bd66bf6",
3
+ "version": "3.5.5-alpha.c95b563",
4
4
  "description": "VibeIQ's Contrail Platform CLI.",
5
5
  "bin": {
6
6
  "contrail-cli": "./bin/run",