@swell/cli 2.9.11 → 2.9.13

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.
@@ -1,6 +1,5 @@
1
1
  import { confirm } from '@inquirer/prompts';
2
- import { Args, Flags } from '@oclif/core';
3
- import { CLIError } from '@oclif/errors';
2
+ import { Args, Errors, Flags } from '@oclif/core';
4
3
  import * as fs from 'node:fs/promises';
5
4
  import ora from 'ora';
6
5
  import * as semver from 'semver';
@@ -15,7 +14,7 @@ export default class AppRelease extends PushAppCommand {
15
14
  if (parsedInput) {
16
15
  return parsedInput;
17
16
  }
18
- throw new CLIError(`Invalid version: ${input}`);
17
+ throw new Errors.CLIError(`Invalid version: ${input}`);
19
18
  },
20
19
  }),
21
20
  };
@@ -1,7 +1,6 @@
1
1
  import { confirm, input } from '@inquirer/prompts';
2
2
  import git from '@npmcli/git';
3
- import { Args, Flags } from '@oclif/core';
4
- import { CLIError } from '@oclif/errors';
3
+ import { Args, Errors, Flags } from '@oclif/core';
5
4
  import ora from 'ora';
6
5
  import * as semver from 'semver';
7
6
  import style from '../../lib/style.js';
@@ -30,7 +29,7 @@ export default class AppVersion extends PushAppCommand {
30
29
  if (parsedInput) {
31
30
  return parsedInput;
32
31
  }
33
- throw new CLIError(`Invalid version: ${input}`);
32
+ throw new Errors.CLIError(`Invalid version: ${input}`);
34
33
  },
35
34
  }),
36
35
  };
@@ -46,6 +46,10 @@ have available for logging in to.
46
46
  const [sessionId, storeId] = await getSessionIdOrLoginInBrowser(store);
47
47
  await this.api.setStoreEnv(storeId);
48
48
  user = await this.api.get({ adminPath: 'user' }, { sessionId });
49
+ const authorization = user?.authorizations?.find((authorization) => authorization.client_id === storeId);
50
+ if (authorization?.client_inactive === true) {
51
+ this.error(`Store "${storeId}" has been deactivated and cannot be used with the CLI. Reactivate it in the dashboard or run \`swell login --force\` to choose another store.`, { exit: 1 });
52
+ }
49
53
  await this.getAndSetStoreConfig({ sessionId, storeId });
50
54
  await modifyDefaultStore({ currentStoreId, storeId }, force);
51
55
  config.setUser(user);
@@ -1,5 +1,4 @@
1
- import { Args } from '@oclif/core';
2
- import { CLIError } from '@oclif/errors';
1
+ import { Args, Errors } from '@oclif/core';
3
2
  import config from '../lib/config.js';
4
3
  import { selectLoggedInStoreId } from '../lib/stores.js';
5
4
  import style from '../lib/style.js';
@@ -35,7 +34,7 @@ define the store that all other commands will apply to by default.
35
34
  this.log(`Current store is now ${style.storeId(config.getDefaultStore())}.`);
36
35
  }
37
36
  else {
38
- throw new CLIError('Could not switch stores.');
37
+ throw new Errors.CLIError('Could not switch stores.');
39
38
  }
40
39
  }
41
40
  }
@@ -32,6 +32,7 @@ function createServer(onSessionId, storeId) {
32
32
  },
33
33
  async onStart(loginUrl) {
34
34
  spinner.start([
35
+ 'Complete login in your browser. Press Ctrl+C to cancel.',
35
36
  "Open this link if your browser doesn't launch it automatically:",
36
37
  `${style.link(loginUrl)}`,
37
38
  ].join(' '));
@@ -38,7 +38,7 @@ export declare function selectStoreId({ authorizations, currentStoreId, force, }
38
38
  *
39
39
  * @param message Store selection message
40
40
  * @returns The store ID to switch to
41
- * @throws CLIError - If there are no stores to switch to
41
+ * @throws Errors.CLIError - If there are no stores to switch to
42
42
  */
43
43
  export declare function selectLoggedInStoreId(message?: string): Promise<string>;
44
44
  /**
@@ -46,7 +46,7 @@ export declare function selectLoggedInStoreId(message?: string): Promise<string>
46
46
  *
47
47
  * @param message Environment selection message
48
48
  * @returns Environment to switch to
49
- * @throws CLIError - If there are no stores to switch to
49
+ * @throws Errors.CLIError - If there are no stores to switch to
50
50
  */
51
51
  export declare function selectEnvironmentId(message?: string): Promise<string>;
52
52
  /**
@@ -1,5 +1,5 @@
1
1
  import { Separator, confirm, select } from '@inquirer/prompts';
2
- import { CLIError } from '@oclif/errors';
2
+ import { Errors } from '@oclif/core';
3
3
  import config from './config.js';
4
4
  import style from './style.js';
5
5
  /**
@@ -18,7 +18,7 @@ import style from './style.js';
18
18
  */
19
19
  export function showStores(stores, currentStoreId) {
20
20
  if (stores.length === 0) {
21
- throw new CLIError('You are not logged in to any store.');
21
+ throw new Errors.CLIError('You are not logged in to any store.');
22
22
  }
23
23
  function currentStoreLabel(store) {
24
24
  if (stores.length === 1 || store.storeId !== currentStoreId) {
@@ -103,13 +103,13 @@ export async function selectStoreId({ authorizations, currentStoreId, force = fa
103
103
  *
104
104
  * @param message Store selection message
105
105
  * @returns The store ID to switch to
106
- * @throws CLIError - If there are no stores to switch to
106
+ * @throws Errors.CLIError - If there are no stores to switch to
107
107
  */
108
108
  export async function selectLoggedInStoreId(message) {
109
109
  const currentStoreId = config.getDefaultStore();
110
110
  const loggedInStores = config.get('stores') || [];
111
111
  if (loggedInStores.length === 0) {
112
- throw new CLIError(`You are not logged in. Run ${style.command('swell login')} to continue.`);
112
+ throw new Errors.CLIError(`You are not logged in. Run ${style.command('swell login')} to continue.`);
113
113
  }
114
114
  const selectStoreChoices = loggedInStores.map((store) => ({
115
115
  name: `${store.name} (${store.storeId})` +
@@ -134,7 +134,7 @@ export async function selectLoggedInStoreId(message) {
134
134
  *
135
135
  * @param message Environment selection message
136
136
  * @returns Environment to switch to
137
- * @throws CLIError - If there are no stores to switch to
137
+ * @throws Errors.CLIError - If there are no stores to switch to
138
138
  */
139
139
  export async function selectEnvironmentId(message) {
140
140
  return select({
@@ -72,6 +72,7 @@ export interface User {
72
72
  export interface UserAuthorization {
73
73
  client_id: string;
74
74
  client_name: string;
75
+ client_inactive?: boolean;
75
76
  }
76
77
  export interface App {
77
78
  id: string;
@@ -3594,5 +3594,5 @@
3594
3594
  ]
3595
3595
  }
3596
3596
  },
3597
- "version": "2.9.11"
3597
+ "version": "2.9.13"
3598
3598
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swell/cli",
3
- "version": "2.9.11",
3
+ "version": "2.9.13",
4
4
  "type": "module",
5
5
  "description": "Swell's command line interface/utility",
6
6
  "keywords": [
@@ -29,9 +29,7 @@
29
29
  "@inquirer/prompts": "3.2.0",
30
30
  "@npmcli/git": "5.0.3",
31
31
  "@oclif/core": "3.7.1",
32
- "@oclif/errors": "1.3.6",
33
32
  "@oclif/plugin-help": "6.0.4",
34
- "@oclif/plugin-plugins": "3.9.4",
35
33
  "ajv": "8.20.0",
36
34
  "ajv-errors": "3.0.0",
37
35
  "ajv-formats": "3.0.1",
@@ -49,18 +47,17 @@
49
47
  "inflection": "3.0.0",
50
48
  "istextorbinary": "9.5.0",
51
49
  "localtunnel": "2.0.2",
52
- "lodash": "4.17.21",
50
+ "lodash": "4.18.1",
53
51
  "mime-detect": "1.2.0",
54
52
  "node-fetch": "3.3.2",
55
- "oclif": "4.0.3",
56
53
  "open": "9.1.0",
57
54
  "ora": "7.0.1",
58
55
  "parse-json": "8.3.0",
59
- "qs": "6.12.3",
56
+ "qs": "6.15.3",
60
57
  "semver": "7.5.4",
61
58
  "table": "6.8.1",
62
59
  "typescript": "5.2.2",
63
- "ws": "8.18.1"
60
+ "ws": "8.21.3"
64
61
  },
65
62
  "devDependencies": {
66
63
  "@inquirer/testing": "2.1.8",