@unito/integration-cli 1.4.0 → 1.5.0

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.
@@ -23,7 +23,7 @@ class Activity extends baseCommand_1.BaseCommand {
23
23
  environment: core_1.Flags.custom({
24
24
  description: 'the environment of the platform',
25
25
  options: Object.values(GlobalConfiguration.Environment),
26
- default: GlobalConfiguration.Environment.Production,
26
+ default: GlobalConfiguration.Environment.Local,
27
27
  })(),
28
28
  follow: core_1.Flags.boolean({
29
29
  char: 'f',
@@ -45,14 +45,13 @@ class Activity extends baseCommand_1.BaseCommand {
45
45
  const { flags } = await this.parse(Activity);
46
46
  // Read the configurations.
47
47
  const globalConfiguration = await GlobalConfiguration.read(this.config.configDir);
48
- const environment = flags.environment ?? GlobalConfiguration.Environment.Production;
49
- const integrationConfiguration = await IntegrationConfiguration.getConfiguration(environment);
48
+ const integrationConfiguration = await IntegrationConfiguration.getConfiguration(flags.environment);
50
49
  // Choose the right API key for the environment.
51
50
  let apiKey = undefined;
52
- if (environment === GlobalConfiguration.Environment.Local) {
51
+ if (flags.environment === GlobalConfiguration.Environment.Local) {
53
52
  apiKey = globalConfiguration.apiKeyLocal;
54
53
  }
55
- else if (environment === GlobalConfiguration.Environment.Staging) {
54
+ else if (flags.environment === GlobalConfiguration.Environment.Staging) {
56
55
  apiKey = globalConfiguration.apiKeyStaging;
57
56
  }
58
57
  else {
@@ -60,7 +59,7 @@ class Activity extends baseCommand_1.BaseCommand {
60
59
  }
61
60
  // Setup the platform client.
62
61
  IntegrationsPlatform.setApiKey(apiKey);
63
- IntegrationsPlatform.setEnvironment(environment);
62
+ IntegrationsPlatform.setEnvironment(flags.environment);
64
63
  core_1.ux.action.start('Finding the integration', undefined, { stdout: true });
65
64
  let integration;
66
65
  try {
@@ -25,7 +25,7 @@ class Dev extends baseCommand_1.BaseCommand {
25
25
  environment: core_1.Flags.custom({
26
26
  description: 'the environment of the platform',
27
27
  options: Object.values(GlobalConfiguration.Environment),
28
- default: GlobalConfiguration.Environment.Production,
28
+ default: GlobalConfiguration.Environment.Local,
29
29
  })(),
30
30
  verbose: core_1.Flags.boolean({
31
31
  description: 'output more (debug) information',
@@ -90,12 +90,11 @@ class Dev extends baseCommand_1.BaseCommand {
90
90
  core_1.ux.action.stop();
91
91
  }
92
92
  // Resolve the configuration.
93
- const environment = flags.environment ?? GlobalConfiguration.Environment.Production;
94
- const configuration = await (0, configuration_1.getConfiguration)(environment, flags['config-path']);
93
+ const configuration = await (0, configuration_1.getConfiguration)(flags.environment, flags['config-path']);
95
94
  let credentialPayload = '{}';
96
95
  let readOnly = flags['read-only'] ?? false;
97
96
  if (flags['credential-id']) {
98
- const credential = await (0, credentials_1.fetchCredential)(environment, this.config.configDir, flags['credential-id']);
97
+ const credential = await (0, credentials_1.fetchCredential)(flags.environment, this.config.configDir, flags['credential-id']);
99
98
  credentialPayload = JSON.stringify({
100
99
  ...credential.payload,
101
100
  unitoCredentialId: credential.id,
@@ -108,9 +107,9 @@ class Dev extends baseCommand_1.BaseCommand {
108
107
  credentialPayload = flags['credential-payload'];
109
108
  }
110
109
  else if (configuration.testAccount && Object.keys(configuration.testAccount).length) {
111
- const decryptedEntries = await (0, decryption_1.decryptEntries)(configuration.name, environment, this.config.configDir, configuration.testAccount);
110
+ const decryptedEntries = await (0, decryption_1.decryptEntries)(configuration.name, flags.environment, this.config.configDir, configuration.testAccount);
112
111
  if (decryptedEntries.failed.length) {
113
- throw new errors_1.EntryDecryptionError(decryptedEntries.failed.at(0), environment);
112
+ throw new errors_1.EntryDecryptionError(decryptedEntries.failed.at(0), flags.environment);
114
113
  }
115
114
  credentialPayload = JSON.stringify({
116
115
  ...decryptedEntries.successful,
@@ -119,12 +118,12 @@ class Dev extends baseCommand_1.BaseCommand {
119
118
  });
120
119
  }
121
120
  // Load secrets.
122
- const { successful: secrets, failed: failedSecrets } = await (0, decryption_1.decryptEntries)(configuration.name, environment, this.config.configDir, configuration.secrets ?? {});
121
+ const { successful: secrets, failed: failedSecrets } = await (0, decryption_1.decryptEntries)(configuration.name, flags.environment, this.config.configDir, configuration.secrets ?? {});
123
122
  if (failedSecrets.length) {
124
- throw new errors_1.EntryDecryptionError(failedSecrets.at(0), environment);
123
+ throw new errors_1.EntryDecryptionError(failedSecrets.at(0), flags.environment);
125
124
  }
126
125
  // Load environment variables.
127
- const { successful: environmentVariables, failed: failedEnvironmentVariables } = await (0, decryption_1.decryptEntries)(configuration.name, environment, this.config.configDir, configuration.environmentVariables ?? {});
126
+ const { successful: environmentVariables, failed: failedEnvironmentVariables } = await (0, decryption_1.decryptEntries)(configuration.name, flags.environment, this.config.configDir, configuration.environmentVariables ?? {});
128
127
  for (const environmentVariable of failedEnvironmentVariables) {
129
128
  if (!process.env[environmentVariable]) {
130
129
  core_1.ux.log();
@@ -18,7 +18,7 @@ class Encrypt extends baseCommand_1.BaseCommand {
18
18
  environment: core_1.Flags.custom({
19
19
  description: 'the environment of the platform',
20
20
  options: Object.values(GlobalConfiguration.Environment),
21
- default: GlobalConfiguration.Environment.Production,
21
+ default: GlobalConfiguration.Environment.Local,
22
22
  })(),
23
23
  sensitive: core_1.Flags.boolean({
24
24
  description: 'once encrypted, sensitive data cannot be decrypted',
@@ -37,9 +37,8 @@ class Encrypt extends baseCommand_1.BaseCommand {
37
37
  const { flags } = await this.parse(Encrypt);
38
38
  // Read the configurations.
39
39
  const globalConfiguration = await GlobalConfiguration.read(this.config.configDir);
40
- const environment = flags.environment ?? GlobalConfiguration.Environment.Production;
41
- const integrationConfiguration = await IntegrationConfiguration.getConfiguration(environment);
42
- await (0, integrationsPlatform_1.validateAuthenticated)(globalConfiguration, environment);
40
+ const integrationConfiguration = await IntegrationConfiguration.getConfiguration(flags.environment);
41
+ await (0, integrationsPlatform_1.validateAuthenticated)(globalConfiguration, flags.environment);
43
42
  const { data } = await inquirer_1.default.prompt({
44
43
  name: 'data',
45
44
  message: 'Enter text to encrypt',
@@ -55,7 +55,7 @@ class Graph extends baseCommand_1.BaseCommand {
55
55
  environment: core_1.Flags.custom({
56
56
  description: 'the environment of the platform',
57
57
  options: Object.values(GlobalConfiguration.Environment),
58
- default: GlobalConfiguration.Environment.Production,
58
+ default: GlobalConfiguration.Environment.Local,
59
59
  })(),
60
60
  'credential-payload': core_1.Flags.string({
61
61
  description: '(advanced) credential payload to use.',
@@ -105,12 +105,11 @@ class Graph extends baseCommand_1.BaseCommand {
105
105
  if (operation === 'deleteItem' && (flags.body || flags['body-file'])) {
106
106
  this.error('--body and --body-file are not supported for deleteItem', { exit: 1 });
107
107
  }
108
- const environment = flags.environment ?? GlobalConfiguration.Environment.Production;
109
- const configuration = await (0, configuration_1.getConfiguration)(environment, flags['config-path']);
108
+ const configuration = await (0, configuration_1.getConfiguration)(flags.environment, flags['config-path']);
110
109
  // Credential resolution — identical to dev.ts
111
110
  let credentialPayload = '{}';
112
111
  if (flags['credential-id']) {
113
- const credential = await (0, credentials_1.fetchCredential)(environment, this.config.configDir, flags['credential-id']);
112
+ const credential = await (0, credentials_1.fetchCredential)(flags.environment, this.config.configDir, flags['credential-id']);
114
113
  credentialPayload = JSON.stringify({
115
114
  ...credential.payload,
116
115
  unitoCredentialId: credential.id,
@@ -121,9 +120,9 @@ class Graph extends baseCommand_1.BaseCommand {
121
120
  credentialPayload = flags['credential-payload'];
122
121
  }
123
122
  else if (configuration.testAccount && Object.keys(configuration.testAccount).length) {
124
- const decryptedEntries = await (0, decryption_1.decryptEntries)(configuration.name, environment, this.config.configDir, configuration.testAccount);
123
+ const decryptedEntries = await (0, decryption_1.decryptEntries)(configuration.name, flags.environment, this.config.configDir, configuration.testAccount);
125
124
  if (decryptedEntries.failed.length) {
126
- throw new errors_1.EntryDecryptionError(decryptedEntries.failed.at(0), environment);
125
+ throw new errors_1.EntryDecryptionError(decryptedEntries.failed.at(0), flags.environment);
127
126
  }
128
127
  credentialPayload = JSON.stringify({
129
128
  ...decryptedEntries.successful,
@@ -132,9 +131,9 @@ class Graph extends baseCommand_1.BaseCommand {
132
131
  });
133
132
  }
134
133
  // Load secrets — identical to dev.ts
135
- const { successful: secrets, failed: failedSecrets } = await (0, decryption_1.decryptEntries)(configuration.name, environment, this.config.configDir, configuration.secrets ?? {});
134
+ const { successful: secrets, failed: failedSecrets } = await (0, decryption_1.decryptEntries)(configuration.name, flags.environment, this.config.configDir, configuration.secrets ?? {});
136
135
  if (failedSecrets.length) {
137
- throw new errors_1.EntryDecryptionError(failedSecrets.at(0), environment);
136
+ throw new errors_1.EntryDecryptionError(failedSecrets.at(0), flags.environment);
138
137
  }
139
138
  // Build Unito request headers.
140
139
  // Encoding: base64(JSON.stringify(payload)) — same as integrationDebugger/src/services/crawlerDriver.ts line 424.
@@ -17,7 +17,7 @@ class Invite extends baseCommand_1.BaseCommand {
17
17
  environment: core_1.Flags.custom({
18
18
  description: 'the environment of the platform',
19
19
  options: Object.values(GlobalConfiguration.Environment),
20
- default: GlobalConfiguration.Environment.Production,
20
+ default: GlobalConfiguration.Environment.Local,
21
21
  })(),
22
22
  };
23
23
  async catch(error) {
@@ -32,14 +32,13 @@ class Invite extends baseCommand_1.BaseCommand {
32
32
  const { flags } = await this.parse(Invite);
33
33
  // Read the configurations.
34
34
  const globalConfiguration = await GlobalConfiguration.read(this.config.configDir);
35
- const environment = flags.environment ?? GlobalConfiguration.Environment.Production;
36
- const integrationConfiguration = await IntegrationConfiguration.getConfiguration(environment);
35
+ const integrationConfiguration = await IntegrationConfiguration.getConfiguration(flags.environment);
37
36
  // Choose the right API key for the environment.
38
37
  let apiKey = undefined;
39
- if (environment === GlobalConfiguration.Environment.Local) {
38
+ if (flags.environment === GlobalConfiguration.Environment.Local) {
40
39
  apiKey = globalConfiguration.apiKeyLocal;
41
40
  }
42
- else if (environment === GlobalConfiguration.Environment.Staging) {
41
+ else if (flags.environment === GlobalConfiguration.Environment.Staging) {
43
42
  apiKey = globalConfiguration.apiKeyStaging;
44
43
  }
45
44
  else {
@@ -47,7 +46,7 @@ class Invite extends baseCommand_1.BaseCommand {
47
46
  }
48
47
  // Setup the platform client.
49
48
  IntegrationsPlatform.setApiKey(apiKey);
50
- IntegrationsPlatform.setEnvironment(environment);
49
+ IntegrationsPlatform.setEnvironment(flags.environment);
51
50
  const { email } = await inquirer_1.default.prompt([
52
51
  {
53
52
  name: 'email',
@@ -16,7 +16,7 @@ class Login extends baseCommand_1.BaseCommand {
16
16
  environment: core_1.Flags.custom({
17
17
  description: 'the environment of the platform',
18
18
  options: Object.values(GlobalConfiguration.Environment),
19
- default: GlobalConfiguration.Environment.Production,
19
+ default: GlobalConfiguration.Environment.Local,
20
20
  })(),
21
21
  };
22
22
  async catch(error) {
@@ -30,7 +30,6 @@ class Login extends baseCommand_1.BaseCommand {
30
30
  const { flags } = await this.parse(Login);
31
31
  // Read the current global configuration.
32
32
  const configuration = await GlobalConfiguration.read(this.config.configDir);
33
- const environment = flags.environment ?? GlobalConfiguration.Environment.Production;
34
33
  // Inquire for the API key.
35
34
  let apiKey = undefined;
36
35
  try {
@@ -49,7 +48,7 @@ class Login extends baseCommand_1.BaseCommand {
49
48
  // Retrieve the user's profile.
50
49
  core_1.ux.action.start('Log in', undefined, { stdout: true });
51
50
  let profile = undefined;
52
- IntegrationsPlatform.setEnvironment(environment);
51
+ IntegrationsPlatform.setEnvironment(flags.environment);
53
52
  IntegrationsPlatform.setApiKey(apiKey);
54
53
  try {
55
54
  profile = await IntegrationsPlatform.getProfile();
@@ -61,10 +60,10 @@ class Login extends baseCommand_1.BaseCommand {
61
60
  core_1.ux.action.stop();
62
61
  core_1.ux.log([chalk_1.default.greenBright('Hello'), gradient.fruit(profile?.email ?? ''), chalk_1.default.greenBright('!')].join(' '));
63
62
  // Set the API key in the global configuration.
64
- if (environment === GlobalConfiguration.Environment.Local) {
63
+ if (flags.environment === GlobalConfiguration.Environment.Local) {
65
64
  configuration.apiKeyLocal = apiKey;
66
65
  }
67
- else if (environment === GlobalConfiguration.Environment.Staging) {
66
+ else if (flags.environment === GlobalConfiguration.Environment.Staging) {
68
67
  configuration.apiKeyStaging = apiKey;
69
68
  }
70
69
  else {
@@ -21,7 +21,7 @@ class Oauth2 extends core_1.Command {
21
21
  environment: core_1.Flags.custom({
22
22
  description: 'the environment of the platform',
23
23
  options: Object.values(globalConfiguration_1.Environment),
24
- default: globalConfiguration_1.Environment.Production,
24
+ default: globalConfiguration_1.Environment.Local,
25
25
  })(),
26
26
  reauth: core_1.Flags.boolean({
27
27
  description: `triggers a new oauth2 flow to overwrite the test account's current credentials`,
@@ -47,9 +47,8 @@ class Oauth2 extends core_1.Command {
47
47
  }
48
48
  async run() {
49
49
  const { flags } = await this.parse(Oauth2);
50
- const environment = flags.environment ?? globalConfiguration_1.Environment.Production;
51
50
  const customConfigPath = flags['config-path'];
52
- const configuration = await (0, configuration_1.getConfiguration)(environment, customConfigPath);
51
+ const configuration = await (0, configuration_1.getConfiguration)(flags.environment, customConfigPath);
53
52
  // First check for development oauth2 authorization scheme
54
53
  let oauth2 = configuration.authorizations?.find(authorization => authorization.method === configurationTypes_1.Method.OAUTH2 && authorization.development)?.oauth2;
55
54
  // Try for any oauth2 authorization scheme if there was no development one
@@ -60,20 +59,20 @@ class Oauth2 extends core_1.Command {
60
59
  throw new errors_1.MissingAuth2AuthorizationError();
61
60
  }
62
61
  // Decrypt any encrypted oauth2 fields (mainly clientSecret)
63
- const decryptedEntries = await (0, decryption_1.decryptEntries)(configuration.name, environment, this.config.configDir, oauth2);
62
+ const decryptedEntries = await (0, decryption_1.decryptEntries)(configuration.name, flags.environment, this.config.configDir, oauth2);
64
63
  if (decryptedEntries.failed.length) {
65
- throw new errors_1.EntryDecryptionError(decryptedEntries.failed.at(0), environment);
64
+ throw new errors_1.EntryDecryptionError(decryptedEntries.failed.at(0), flags.environment);
66
65
  }
67
66
  oauth2 = decryptedEntries.successful;
68
67
  const testAccountCredentials = configuration.testAccount;
69
68
  let decryptionResult;
70
69
  if (testAccountCredentials) {
71
- decryptionResult = await (0, decryption_1.decryptEntries)(configuration.name, environment, this.config.configDir, testAccountCredentials);
70
+ decryptionResult = await (0, decryption_1.decryptEntries)(configuration.name, flags.environment, this.config.configDir, testAccountCredentials);
72
71
  }
73
72
  let credentials;
74
73
  if (!testAccountCredentials?.accessToken || flags.reauth) {
75
74
  core_1.ux.log(`Starting OAuth2 flow for test account`);
76
- credentials = await Oauth2Resource.performOAuth2Flow(oauth2, environment, testAccountCredentials);
75
+ credentials = await Oauth2Resource.performOAuth2Flow(oauth2, flags.environment, testAccountCredentials);
77
76
  core_1.ux.log(`OAuth2 flow... Done`);
78
77
  }
79
78
  else {
@@ -83,7 +82,7 @@ class Oauth2 extends core_1.Command {
83
82
  }
84
83
  const refreshToken = decryptionResult?.successful.refreshToken;
85
84
  core_1.ux.action.start(`Refreshing test account`, undefined, { stdout: true });
86
- credentials = await Oauth2Resource.updateToken(oauth2, refreshToken, decryptionResult?.successful, environment);
85
+ credentials = await Oauth2Resource.updateToken(oauth2, refreshToken, decryptionResult?.successful, flags.environment);
87
86
  // If provider response doesn't contain a new refresh token, use the existing one
88
87
  credentials.refreshToken = credentials.refreshToken ?? refreshToken;
89
88
  core_1.ux.action.stop();
@@ -94,7 +93,7 @@ class Oauth2 extends core_1.Command {
94
93
  credentials.refreshToken = (await IntegrationsPlatform.encryptData(configuration.name, credentials.refreshToken, false)).encryptedData;
95
94
  }
96
95
  core_1.ux.action.start(`Saving credentials for test account`, undefined, { stdout: true });
97
- await (0, configuration_1.writeTestAccount)(configuration, environment, customConfigPath, credentials);
96
+ await (0, configuration_1.writeTestAccount)(configuration, flags.environment, customConfigPath, credentials);
98
97
  core_1.ux.action.stop();
99
98
  }
100
99
  }
@@ -26,7 +26,7 @@ class Publish extends baseCommand_1.BaseCommand {
26
26
  environment: core_1.Flags.custom({
27
27
  description: 'the environment of the platform',
28
28
  options: Object.values(GlobalConfiguration.Environment),
29
- default: GlobalConfiguration.Environment.Production,
29
+ default: GlobalConfiguration.Environment.Local,
30
30
  })(),
31
31
  'registry-only': core_1.Flags.boolean({
32
32
  description: 'only update the registry without publishing code',
@@ -80,7 +80,6 @@ class Publish extends baseCommand_1.BaseCommand {
80
80
  const { flags } = await this.parse(Publish);
81
81
  // Read the configurations.
82
82
  const globalConfiguration = await GlobalConfiguration.read(this.config.configDir);
83
- const environment = flags.environment ?? GlobalConfiguration.Environment.Production;
84
83
  // Runtime guards. oclif's dependsOn/relationships can't be used for the
85
84
  // "--visibility=public requires --preview" rule because --preview has
86
85
  // `default: false` and oclif treats defaulted booleans as "present".
@@ -89,7 +88,7 @@ class Publish extends baseCommand_1.BaseCommand {
89
88
  core_1.ux.log(chalk_1.default.redBright('--visibility=public is only supported in combination with --preview.'));
90
89
  this.exit(-1);
91
90
  }
92
- if (environment === GlobalConfiguration.Environment.Production) {
91
+ if (flags.environment === GlobalConfiguration.Environment.Production) {
93
92
  core_1.ux.log(chalk_1.default.redBright('--visibility=public is not supported on --environment=production. ' +
94
93
  'Publish privately first; changing visibility on production is handled by a separate process.'));
95
94
  this.exit(-1);
@@ -98,11 +97,11 @@ class Publish extends baseCommand_1.BaseCommand {
98
97
  if (flags['display-name'] !== undefined &&
99
98
  !flags.preview &&
100
99
  !flags['live-preview'] &&
101
- environment !== GlobalConfiguration.Environment.Local) {
100
+ flags.environment !== GlobalConfiguration.Environment.Local) {
102
101
  core_1.ux.log(chalk_1.default.redBright('--display-name is only supported with --preview, --live-preview, or --environment=local.'));
103
102
  this.exit(-1);
104
103
  }
105
- const integrationConfiguration = await IntegrationConfiguration.getConfiguration(environment, flags['config-path']);
104
+ const integrationConfiguration = await IntegrationConfiguration.getConfiguration(flags.environment, flags['config-path']);
106
105
  if (flags['display-name'] !== undefined) {
107
106
  // Set the base display name. Mode-specific suffixes ("Preview - {hash}", "Live Preview - {hash}")
108
107
  // are appended later inside the corresponding preview methods.
@@ -115,7 +114,7 @@ class Publish extends baseCommand_1.BaseCommand {
115
114
  integrationConfiguration.authorizations = integrationConfiguration.authorizations.filter(authorization => !authorization.development);
116
115
  }
117
116
  // Login to the platform.
118
- await (0, integrationsPlatform_1.validateAuthenticated)(globalConfiguration, environment);
117
+ await (0, integrationsPlatform_1.validateAuthenticated)(globalConfiguration, flags.environment);
119
118
  // Package the integration.
120
119
  tmp_1.default.setGracefulCleanup();
121
120
  if (flags['live-preview']) {
@@ -123,7 +122,7 @@ class Publish extends baseCommand_1.BaseCommand {
123
122
  }
124
123
  else if (flags['registry-only']) {
125
124
  let proceed = true;
126
- if (!flags.force && environment === GlobalConfiguration.Environment.Production) {
125
+ if (!flags.force && flags.environment === GlobalConfiguration.Environment.Production) {
127
126
  ({ proceed } = await inquirer_1.default.prompt({
128
127
  name: 'proceed',
129
128
  message: '🙈🔫 You are about to update an integration in production directly. This is unusual, you should go through the normal publish and review process, are you sure you want to proceed?',
@@ -131,7 +130,7 @@ class Publish extends baseCommand_1.BaseCommand {
131
130
  }));
132
131
  }
133
132
  if (proceed) {
134
- core_1.ux.log(`🙈 Hang on tight, updating Integration ${integrationConfiguration.name} information's in ${environment}!`);
133
+ core_1.ux.log(`🙈 Hang on tight, updating Integration ${integrationConfiguration.name} information's in ${flags.environment}!`);
135
134
  await this.updateRegistry(integrationConfiguration);
136
135
  }
137
136
  else {
@@ -33,7 +33,7 @@ class SchemaSnapshot extends baseCommand_1.BaseCommand {
33
33
  environment: core_1.Flags.custom({
34
34
  description: 'the environment of the platform',
35
35
  options: Object.values(GlobalConfiguration.Environment),
36
- default: GlobalConfiguration.Environment.Production,
36
+ default: GlobalConfiguration.Environment.Local,
37
37
  })(),
38
38
  'config-path': core_1.Flags.string({
39
39
  description: 'relative path to a custom ".unito.json" file',
@@ -60,8 +60,7 @@ class SchemaSnapshot extends baseCommand_1.BaseCommand {
60
60
  async run() {
61
61
  (0, integrations_1.validateIsIntegrationDirectory)();
62
62
  const { flags } = await this.parse(SchemaSnapshot);
63
- const environment = flags.environment ?? GlobalConfiguration.Environment.Production;
64
- const config = await (0, configuration_1.getConfiguration)(environment, flags['config-path']);
63
+ const config = await (0, configuration_1.getConfiguration)(flags.environment, flags['config-path']);
65
64
  if (!flags['skip-install']) {
66
65
  core_1.ux.action.start('Installing NPM dependencies', undefined, { stdout: true });
67
66
  child_process_1.default.execSync('npm install', {
@@ -72,9 +71,9 @@ class SchemaSnapshot extends baseCommand_1.BaseCommand {
72
71
  }
73
72
  // Resolve credentials.
74
73
  const credentials = config.testAccount ?? {};
75
- const decryptedCreds = await (0, decryption_1.decryptEntries)(config.name, environment, this.config.configDir, credentials);
74
+ const decryptedCreds = await (0, decryption_1.decryptEntries)(config.name, flags.environment, this.config.configDir, credentials);
76
75
  if (decryptedCreds.failed.length) {
77
- throw new errors_1.EntryDecryptionError(decryptedCreds.failed.at(0), environment);
76
+ throw new errors_1.EntryDecryptionError(decryptedCreds.failed.at(0), flags.environment);
78
77
  }
79
78
  const credentialPayload = {
80
79
  ...decryptedCreds.successful,
@@ -82,9 +81,9 @@ class SchemaSnapshot extends baseCommand_1.BaseCommand {
82
81
  unitoUserId: 'testAccount',
83
82
  };
84
83
  // Load secrets.
85
- const { successful: secrets, failed: failedSecrets } = await (0, decryption_1.decryptEntries)(config.name, environment, this.config.configDir, config.secrets ?? {});
84
+ const { successful: secrets, failed: failedSecrets } = await (0, decryption_1.decryptEntries)(config.name, flags.environment, this.config.configDir, config.secrets ?? {});
86
85
  if (failedSecrets.length) {
87
- throw new errors_1.EntryDecryptionError(failedSecrets.at(0), environment);
86
+ throw new errors_1.EntryDecryptionError(failedSecrets.at(0), flags.environment);
88
87
  }
89
88
  core_1.ux.action.start('Starting integration', undefined, { stdout: true });
90
89
  const integrationPort = String(flags.port);
@@ -19,7 +19,7 @@ class Test extends baseCommand_1.BaseCommand {
19
19
  environment: core_1.Flags.custom({
20
20
  description: 'the environment of the platform',
21
21
  options: Object.values(GlobalConfiguration.Environment),
22
- default: GlobalConfiguration.Environment.Production,
22
+ default: GlobalConfiguration.Environment.Local,
23
23
  })(),
24
24
  verbose: core_1.Flags.boolean({
25
25
  description: 'output more (debug) information',
@@ -108,12 +108,11 @@ class Test extends baseCommand_1.BaseCommand {
108
108
  core_1.ux.action.stop();
109
109
  }
110
110
  // Resolve the configuration.
111
- const environment = flags.environment ?? GlobalConfiguration.Environment.Production;
112
- const configuration = await (0, configuration_1.getConfiguration)(environment, flags['config-path']);
111
+ const configuration = await (0, configuration_1.getConfiguration)(flags.environment, flags['config-path']);
113
112
  let credentialPayload = '{}';
114
113
  let readOnly = flags['read-only'] ?? false;
115
114
  if (flags['credential-id']) {
116
- const credential = await (0, credentials_1.fetchCredential)(environment, this.config.configDir, flags['credential-id']);
115
+ const credential = await (0, credentials_1.fetchCredential)(flags.environment, this.config.configDir, flags['credential-id']);
117
116
  credentialPayload = JSON.stringify({
118
117
  ...credential.payload,
119
118
  unitoCredentialId: credential.id,
@@ -126,9 +125,9 @@ class Test extends baseCommand_1.BaseCommand {
126
125
  credentialPayload = flags['credential-payload'];
127
126
  }
128
127
  else if (configuration.testAccount && Object.keys(configuration.testAccount).length) {
129
- const decryptedEntries = await (0, decryption_1.decryptEntries)(configuration.name, environment, this.config.configDir, configuration.testAccount);
128
+ const decryptedEntries = await (0, decryption_1.decryptEntries)(configuration.name, flags.environment, this.config.configDir, configuration.testAccount);
130
129
  if (decryptedEntries.failed.length) {
131
- throw new errors_1.EntryDecryptionError(decryptedEntries.failed.at(0), environment);
130
+ throw new errors_1.EntryDecryptionError(decryptedEntries.failed.at(0), flags.environment);
132
131
  }
133
132
  credentialPayload = JSON.stringify({
134
133
  ...decryptedEntries.successful,
@@ -137,12 +136,12 @@ class Test extends baseCommand_1.BaseCommand {
137
136
  });
138
137
  }
139
138
  // Load secrets.
140
- const { successful: secrets, failed: failedSecrets } = await (0, decryption_1.decryptEntries)(configuration.name, environment, this.config.configDir, configuration.secrets ?? {});
139
+ const { successful: secrets, failed: failedSecrets } = await (0, decryption_1.decryptEntries)(configuration.name, flags.environment, this.config.configDir, configuration.secrets ?? {});
141
140
  if (failedSecrets.length) {
142
- throw new errors_1.EntryDecryptionError(failedSecrets.at(0), environment);
141
+ throw new errors_1.EntryDecryptionError(failedSecrets.at(0), flags.environment);
143
142
  }
144
143
  // Load environment variables.
145
- const { successful: environmentVariables, failed: failedEnvironmentVariables } = await (0, decryption_1.decryptEntries)(configuration.name, environment, this.config.configDir, configuration.environmentVariables ?? {});
144
+ const { successful: environmentVariables, failed: failedEnvironmentVariables } = await (0, decryption_1.decryptEntries)(configuration.name, flags.environment, this.config.configDir, configuration.environmentVariables ?? {});
146
145
  for (const environmentVariable of failedEnvironmentVariables) {
147
146
  if (!process.env[environmentVariable]) {
148
147
  core_1.ux.log();
@@ -34,14 +34,14 @@ describe('encrypt', () => {
34
34
  test_1.test
35
35
  .stdout()
36
36
  .stub(GlobalConfiguration, 'read', stub => stub.returns({ apiKey: 'foo' }))
37
- .command(['encrypt'])
37
+ .command(['encrypt', '--environment=production'])
38
38
  .it('encrypts data - default', ctx => {
39
39
  (0, test_1.expect)(ctx.stdout).to.contains('Encrypted Data:');
40
40
  });
41
41
  test_1.test
42
42
  .stdout()
43
43
  .stub(GlobalConfiguration, 'read', stub => stub.returns({ apiKey: 'foo' }))
44
- .command(['encrypt', '--sensitive'])
44
+ .command(['encrypt', '--sensitive', '--environment=production'])
45
45
  .it('encrypts data - sensitive', ctx => {
46
46
  (0, test_1.expect)(ctx.stdout).to.contains('Encrypted Data:');
47
47
  });
@@ -92,7 +92,7 @@ describe('oauth2', () => {
92
92
  (0, test_1.expect)(performOAuth2FlowStub.getCalls().length).to.equal(1);
93
93
  (0, test_1.expect)(performOAuth2FlowStub.getCall(0).args).to.deep.equal([
94
94
  { ...oauth2Information, clientId: 'devClientID' },
95
- 'production',
95
+ 'local',
96
96
  undefined,
97
97
  ]);
98
98
  (0, test_1.expect)(updateTokenStub.getCalls().length).to.equal(0);
@@ -109,7 +109,7 @@ describe('oauth2', () => {
109
109
  },
110
110
  ],
111
111
  },
112
- 'production',
112
+ 'local',
113
113
  undefined,
114
114
  credentials,
115
115
  ]);
@@ -138,7 +138,7 @@ describe('oauth2', () => {
138
138
  ...baseConfiguration,
139
139
  testAccount: credentials,
140
140
  },
141
- 'production',
141
+ 'local',
142
142
  undefined,
143
143
  credentials,
144
144
  ]);
@@ -167,7 +167,7 @@ describe('oauth2', () => {
167
167
  ...baseConfiguration,
168
168
  testAccount: {},
169
169
  },
170
- 'production',
170
+ 'local',
171
171
  undefined,
172
172
  credentials,
173
173
  ]);
@@ -196,7 +196,7 @@ describe('oauth2', () => {
196
196
  ...baseConfiguration,
197
197
  testAccount: credentials,
198
198
  },
199
- 'production',
199
+ 'local',
200
200
  undefined,
201
201
  credentials,
202
202
  ]);
@@ -256,7 +256,7 @@ describe('oauth2', () => {
256
256
  refreshToken: `${Configuration.ENCRYPTION_PREFIX}devRefreshToken`,
257
257
  },
258
258
  },
259
- 'production',
259
+ 'local',
260
260
  undefined,
261
261
  {
262
262
  accessToken: `${Configuration.ENCRYPTION_PREFIX}encryptedAccessToken`,
@@ -330,15 +330,15 @@ describe('oauth2', () => {
330
330
  .onSecondCall()
331
331
  .resolves({ successful: { refreshToken: 'test-refresh-token' }, failed: [] }))
332
332
  .command(['oauth2'])
333
- .it('defaults to production environment when no environment flag is specified', () => {
333
+ .it('defaults to local environment when no environment flag is specified', () => {
334
334
  (0, test_1.expect)(performOAuth2FlowStub.getCalls().length).to.equal(0);
335
335
  (0, test_1.expect)(updateTokenStub.getCalls().length).to.equal(1);
336
- // Verify that updateToken was called with the default production environment
336
+ // Verify that updateToken was called with the default local environment
337
337
  const updateTokenCall = updateTokenStub.getCall(0);
338
338
  (0, test_1.expect)(updateTokenCall.args).to.have.lengthOf(4);
339
339
  (0, test_1.expect)(updateTokenCall.args[0]).to.deep.equal(oauth2Information); // oauth2 config
340
340
  (0, test_1.expect)(updateTokenCall.args[1]).to.equal('test-refresh-token'); // refresh token
341
341
  (0, test_1.expect)(updateTokenCall.args[2]).to.deep.equal({ refreshToken: 'test-refresh-token' }); // credential payload
342
- (0, test_1.expect)(updateTokenCall.args[3]).to.equal('production'); // environment (default)
342
+ (0, test_1.expect)(updateTokenCall.args[3]).to.equal('local'); // environment (default)
343
343
  });
344
344
  });
@@ -45,7 +45,7 @@ describe('Publish', () => {
45
45
  .stub(IntegrationConfiguration, 'getConfiguration', stub => stub.returns({ name: 'a' }))
46
46
  .stub(IntegrationsPlatform, 'getIntegrationByName', stub => stub.returns(undefined))
47
47
  .stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
48
- .command(['publish'])
48
+ .command(['publish', '--environment=production'])
49
49
  .it('publish the integration - default', ctx => {
50
50
  (0, test_1.expect)(ctx.stdout).to.contain('published');
51
51
  });
@@ -55,7 +55,7 @@ describe('Publish', () => {
55
55
  .stub(IntegrationConfiguration, 'getConfiguration', stub => stub.returns({ name: 'a' }))
56
56
  .stub(IntegrationsPlatform, 'getIntegrationByName', stub => stub.returns(undefined))
57
57
  .stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
58
- .command(['publish', '--config-path', '/custom-config.json'])
58
+ .command(['publish', '--config-path', '/custom-config.json', '--environment=production'])
59
59
  .it('publish the integration with custom config - default', ctx => {
60
60
  (0, test_1.expect)(ctx.stdout).to.contain('published');
61
61
  });
@@ -111,7 +111,7 @@ describe('Publish', () => {
111
111
  .stub(IntegrationConfiguration, 'getConfiguration', stub => stub.returns({ name: 'a' }))
112
112
  .stub(IntegrationsPlatform, 'getIntegrationByName', stub => stub.returns(undefined))
113
113
  .stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
114
- .command(['publish', '--config-path', '/my-awesome-config.json'])
114
+ .command(['publish', '--config-path', '/my-awesome-config.json', '--environment=production'])
115
115
  .it('publish the integration using custom configuration', ctx => {
116
116
  (0, test_1.expect)(ctx.stdout).to.contain('published');
117
117
  });
@@ -122,7 +122,7 @@ describe('Publish', () => {
122
122
  .stub(IntegrationsPlatform, 'getIntegrationByName', stub => stub.returns(undefined))
123
123
  .stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
124
124
  .stub(inquirer_1.default, 'prompt', stub => stub.resolves({ proceed: false }))
125
- .command(['publish', '--registry-only'])
125
+ .command(['publish', '--registry-only', '--environment=production'])
126
126
  .it('aborts on user negative input', ctx => {
127
127
  (0, test_1.expect)(ctx.stdout).to.contain('🙊 Abort! You are safe now 🍸 relax');
128
128
  });
@@ -135,7 +135,7 @@ describe('Publish', () => {
135
135
  .stub(IntegrationsPlatform, 'updateIntegration', stub => stub.resolves(integration))
136
136
  .stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
137
137
  .stub(inquirer_1.default, 'prompt', stub => stub.resolves({ proceed: false }))
138
- .command(['publish', '--registry-only', '--force'])
138
+ .command(['publish', '--registry-only', '--force', '--environment=production'])
139
139
  .it('bypass user confirmation with --force is active', ctx => {
140
140
  (0, test_1.expect)(ctx.stdout).to.contain('created');
141
141
  });
@@ -148,7 +148,7 @@ describe('Publish', () => {
148
148
  .stub(IntegrationsPlatform, 'updateIntegration', stub => stub.resolves(integration))
149
149
  .stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
150
150
  .stub(inquirer_1.default, 'prompt', stub => stub.resolves({ proceed: true }))
151
- .command(['publish', '--registry-only'])
151
+ .command(['publish', '--registry-only', '--environment=production'])
152
152
  .it('creates the integration in the registry', ctx => {
153
153
  (0, test_1.expect)(ctx.stdout).to.contain('created');
154
154
  });
@@ -161,7 +161,7 @@ describe('Publish', () => {
161
161
  .stub(IntegrationsPlatform, 'updateIntegration', stub => stub.resolves(integration))
162
162
  .stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
163
163
  .stub(inquirer_1.default, 'prompt', stub => stub.resolves({ proceed: true }))
164
- .command(['publish', '--registry-only'])
164
+ .command(['publish', '--registry-only', '--environment=production'])
165
165
  .it('updates the integration in the registry', ctx => {
166
166
  (0, test_1.expect)(ctx.stdout).to.contain('updated');
167
167
  });
@@ -176,7 +176,7 @@ describe('Publish', () => {
176
176
  .stub(IntegrationsPlatform, 'updateIntegration', stub => stub.resolves(integration))
177
177
  .stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
178
178
  .stub(inquirer_1.default, 'prompt', stub => stub.resolves({ proceed: true }))
179
- .command(['publish', '--registry-only'])
179
+ .command(['publish', '--registry-only', '--environment=production'])
180
180
  .it('filters out "development" authorizations', ctx => {
181
181
  ctx.sandbox.assert.calledOnceWithMatch(
182
182
  // @ts-expect-error syntax accepted by sinon.
@@ -200,7 +200,7 @@ describe('Publish', () => {
200
200
  .stub(IntegrationsPlatform, 'createIntegration', stub => stub.resolves(integration))
201
201
  .stub(IntegrationsPlatform, 'updateIntegration', stub => stub.resolves(integration))
202
202
  .stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
203
- .command(['publish', '--preview'])
203
+ .command(['publish', '--preview', '--environment=production'])
204
204
  .it('preview the integration', ctx => {
205
205
  (0, test_1.expect)(ctx.stdout).to.contain('published');
206
206
  });
@@ -211,7 +211,7 @@ describe('Publish', () => {
211
211
  .stub(IntegrationsPlatform, 'getIntegrationByName', stub => stub.returns(undefined))
212
212
  .stub(IntegrationConfiguration, 'writeConfiguration', stub => stub.returns(integration))
213
213
  .stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
214
- .command(['publish', '--preview'])
214
+ .command(['publish', '--preview', '--environment=production'])
215
215
  .it('preview the integration - override the display name', ctx => {
216
216
  (0, test_1.expect)((0, styles_1.uncolorize)(ctx.stdout)).to.contain('foo-preview-9c88 is being published');
217
217
  });
@@ -223,7 +223,7 @@ describe('Publish', () => {
223
223
  .stub(IntegrationsPlatform, 'createIntegration', stub => stub.resolves(integration))
224
224
  .stub(IntegrationsPlatform, 'updateIntegration', stub => stub.resolves(integration))
225
225
  .stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
226
- .command(['publish', '--live-preview'])
226
+ .command(['publish', '--live-preview', '--environment=production'])
227
227
  .it('live-preview the integration', ctx => {
228
228
  (0, test_1.expect)(ctx.stdout).to.contain('created');
229
229
  });
@@ -234,7 +234,7 @@ describe('Publish', () => {
234
234
  .stub(IntegrationsPlatform, 'getIntegrationByName', stub => stub.returns(undefined))
235
235
  .stub(IntegrationsPlatform, 'createIntegration', stub => stub.resolves(integration))
236
236
  .stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
237
- .command(['publish', '--live-preview'])
237
+ .command(['publish', '--live-preview', '--environment=production'])
238
238
  .it('live-preview the integration - override the display name', ctx => {
239
239
  ctx.sandbox.assert.calledOnceWithMatch(
240
240
  // @ts-expect-error syntax accepted by sinon.
@@ -251,7 +251,7 @@ describe('Publish', () => {
251
251
  .stub(IntegrationConfiguration, 'getConfiguration', stub => stub.returns({}))
252
252
  .stub(IntegrationsPlatform, 'getIntegrationByName', stub => stub.returns(undefined))
253
253
  .stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
254
- .command(['publish'])
254
+ .command(['publish', '--environment=production'])
255
255
  .exit(-1)
256
256
  .it('missing api key', ctx => {
257
257
  (0, test_1.expect)(ctx.stderr).to.contain('Your API key is not set!\nMake sure to run the login command first');
@@ -261,7 +261,7 @@ describe('Publish', () => {
261
261
  .stderr()
262
262
  .stub(GlobalConfiguration, 'read', stub => stub.throws(new errors_1.NoConfigurationFileError()))
263
263
  .stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
264
- .command(['publish'])
264
+ .command(['publish', '--environment=production'])
265
265
  .exit(-1)
266
266
  .it('handles exception');
267
267
  test_1.test
@@ -279,7 +279,7 @@ describe('Publish', () => {
279
279
  }))
280
280
  .stub(IntegrationsPlatform, 'getIntegrationByName', stub => stub.returns(undefined))
281
281
  .stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
282
- .command(['publish', '--preview'])
282
+ .command(['publish', '--preview', '--environment=production'])
283
283
  .it('reencrypts the clientSecret on preview', ctx => {
284
284
  (0, test_1.expect)(ctx.stdout).to.contain('Reencrypting oauth2:clientSecret');
285
285
  (0, test_1.expect)(ctx.stdout).to.contain('Reencrypting secrets:secret1');
@@ -297,7 +297,7 @@ describe('Publish', () => {
297
297
  .stub(IntegrationsPlatform, 'createIntegration', stub => stub.resolves(integration))
298
298
  .stub(IntegrationsPlatform, 'updateIntegration', stub => stub.resolves(integration))
299
299
  .stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
300
- .command(['publish', '--live-preview'])
300
+ .command(['publish', '--live-preview', '--environment=production'])
301
301
  .it('reencrypts the clientSecret on live-preview', ctx => {
302
302
  (0, test_1.expect)(ctx.stdout).to.contain('Reencrypting oauth2:clientSecret');
303
303
  (0, test_1.expect)(ctx.stdout).to.contain('Reencrypting secrets:secret1');
@@ -314,7 +314,7 @@ describe('Publish', () => {
314
314
  .stub(IntegrationsPlatform, 'createIntegration', stub => stub.resolves(integration))
315
315
  .stub(IntegrationsPlatform, 'updateIntegration', stub => stub.resolves(integration))
316
316
  .stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
317
- .command(['publish', '--live-preview'])
317
+ .command(['publish', '--live-preview', '--environment=production'])
318
318
  .it('skips reencryption', ctx => {
319
319
  (0, test_1.expect)(ctx.stdout).to.contain('Skipping oauth2:clientSecret');
320
320
  });
@@ -334,7 +334,7 @@ describe('Publish', () => {
334
334
  .stub(IntegrationsPlatform, 'updateIntegration', stub => stub.resolves(integration))
335
335
  .stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('foo')))
336
336
  .stub(inquirer_1.default, 'prompt', stub => stub.resolves({ proceed: true }))
337
- .command(['publish', '--registry-only'])
337
+ .command(['publish', '--registry-only', '--environment=production'])
338
338
  .it('update assets', ctx => {
339
339
  (0, test_1.expect)(ctx.stdout).to.contain('image: <set>');
340
340
  (0, test_1.expect)(ctx.stdout).to.contain('markdown: <set>');
@@ -355,7 +355,7 @@ describe('Publish', () => {
355
355
  .stub(inquirer_1.default, 'prompt', stub => stub.resolves({ proceed: true }))
356
356
  .stub(IntegrationsPlatform, 'createIntegration', stub => stub.resolves(integration))
357
357
  .stub(IntegrationsPlatform, 'updateIntegration', stub => stub.resolves(integration))
358
- .command(['publish', '--registry-only'])
358
+ .command(['publish', '--registry-only', '--environment=production'])
359
359
  .it('it defaults instructions to null if no file in assets folder', ctx => {
360
360
  (0, test_1.expect)(ctx.stdout).to.contain('image: <unset>');
361
361
  (0, test_1.expect)(ctx.stdout).to.contain('markdown: <unset>');
@@ -444,7 +444,7 @@ describe('Publish', () => {
444
444
  .stub(IntegrationConfiguration, 'getConfiguration', stub => stub.returns({ name: 'foo' }))
445
445
  .stub(IntegrationsPlatform, 'getIntegrationByName', stub => stub.returns(undefined))
446
446
  .stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
447
- .command(['publish', '--display-name', 'PR-1234'])
447
+ .command(['publish', '--display-name', 'PR-1234', '--environment=production'])
448
448
  .exit(-1)
449
449
  .it('rejects --display-name without --preview or --live-preview', ctx => {
450
450
  (0, test_1.expect)((0, styles_1.uncolorize)(ctx.stdout)).to.contain('--display-name is only supported with --preview, --live-preview, or --environment=local');
@@ -474,7 +474,7 @@ describe('Publish', () => {
474
474
  .stub(IntegrationsPlatform, 'getIntegrationByName', stub => stub.returns(undefined))
475
475
  .stub(IntegrationConfiguration, 'writeConfiguration', stub => stub.returns(integration))
476
476
  .stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
477
- .command(['publish', '--preview', '--display-name', 'PR-1234'])
477
+ .command(['publish', '--preview', '--display-name', 'PR-1234', '--environment=production'])
478
478
  .it('private preview - --display-name overrides the base, hash suffix still appended', ctx => {
479
479
  (0, test_1.expect)((0, styles_1.uncolorize)(ctx.stdout)).to.contain('foo-preview-9c88 is being published');
480
480
  ctx.sandbox.assert.calledWithMatch(
@@ -534,7 +534,7 @@ describe('Publish', () => {
534
534
  .stub(IntegrationConfiguration, 'getConfiguration', stub => stub.returns({ name: 'foo' }))
535
535
  .stub(IntegrationsPlatform, 'getIntegrationByName', stub => stub.returns(undefined))
536
536
  .stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
537
- .command(['publish', '--visibility=public', '--registry-only'])
537
+ .command(['publish', '--visibility=public', '--registry-only', '--environment=production'])
538
538
  .exit(2)
539
539
  .it('oclif rejects --visibility + --registry-only (exclusive)', _ctx => { });
540
540
  test_1.test
@@ -544,7 +544,7 @@ describe('Publish', () => {
544
544
  .stub(IntegrationConfiguration, 'getConfiguration', stub => stub.returns({ name: 'foo' }))
545
545
  .stub(IntegrationsPlatform, 'getIntegrationByName', stub => stub.returns(undefined))
546
546
  .stub(FileSystem, 'getFileBuffer', stub => stub.resolves(Buffer.from('')))
547
- .command(['publish', '--display-name=Foo', '--registry-only'])
547
+ .command(['publish', '--display-name=Foo', '--registry-only', '--environment=production'])
548
548
  .exit(2)
549
549
  .it('oclif rejects --display-name + --registry-only (exclusive)', _ctx => { });
550
550
  });
@@ -27,7 +27,7 @@
27
27
  "environment": {
28
28
  "description": "the environment of the platform",
29
29
  "name": "environment",
30
- "default": "production",
30
+ "default": "local",
31
31
  "hasDynamicHelp": false,
32
32
  "multiple": false,
33
33
  "options": [
@@ -80,7 +80,7 @@
80
80
  "environment": {
81
81
  "description": "the environment of the platform",
82
82
  "name": "environment",
83
- "default": "production",
83
+ "default": "local",
84
84
  "hasDynamicHelp": false,
85
85
  "multiple": false,
86
86
  "options": [
@@ -208,7 +208,7 @@
208
208
  "environment": {
209
209
  "description": "the environment of the platform",
210
210
  "name": "environment",
211
- "default": "production",
211
+ "default": "local",
212
212
  "hasDynamicHelp": false,
213
213
  "multiple": false,
214
214
  "options": [
@@ -293,7 +293,7 @@
293
293
  "environment": {
294
294
  "description": "the environment of the platform",
295
295
  "name": "environment",
296
- "default": "production",
296
+ "default": "local",
297
297
  "hasDynamicHelp": false,
298
298
  "multiple": false,
299
299
  "options": [
@@ -443,7 +443,7 @@
443
443
  "environment": {
444
444
  "description": "the environment of the platform",
445
445
  "name": "environment",
446
- "default": "production",
446
+ "default": "local",
447
447
  "hasDynamicHelp": false,
448
448
  "multiple": false,
449
449
  "options": [
@@ -488,7 +488,7 @@
488
488
  "environment": {
489
489
  "description": "the environment of the platform",
490
490
  "name": "environment",
491
- "default": "production",
491
+ "default": "local",
492
492
  "hasDynamicHelp": false,
493
493
  "multiple": false,
494
494
  "options": [
@@ -527,7 +527,7 @@
527
527
  "environment": {
528
528
  "description": "the environment of the platform",
529
529
  "name": "environment",
530
- "default": "production",
530
+ "default": "local",
531
531
  "hasDynamicHelp": false,
532
532
  "multiple": false,
533
533
  "options": [
@@ -587,7 +587,7 @@
587
587
  "environment": {
588
588
  "description": "the environment of the platform",
589
589
  "name": "environment",
590
- "default": "production",
590
+ "default": "local",
591
591
  "hasDynamicHelp": false,
592
592
  "multiple": false,
593
593
  "options": [
@@ -718,7 +718,7 @@
718
718
  "environment": {
719
719
  "description": "the environment of the platform",
720
720
  "name": "environment",
721
- "default": "production",
721
+ "default": "local",
722
722
  "hasDynamicHelp": false,
723
723
  "multiple": false,
724
724
  "options": [
@@ -790,7 +790,7 @@
790
790
  "environment": {
791
791
  "description": "the environment of the platform",
792
792
  "name": "environment",
793
- "default": "production",
793
+ "default": "local",
794
794
  "hasDynamicHelp": false,
795
795
  "multiple": false,
796
796
  "options": [
@@ -974,5 +974,5 @@
974
974
  ]
975
975
  }
976
976
  },
977
- "version": "1.4.0"
977
+ "version": "1.5.0"
978
978
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unito/integration-cli",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Integration CLI",
5
5
  "bin": {
6
6
  "integration-cli": "./bin/run"