@salesforce/core 3.9.0 → 3.11.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,30 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [3.11.0](https://github.com/forcedotcom/sfdx-core/compare/v3.10.1...v3.11.0) (2022-03-30)
6
+
7
+ ### Features
8
+
9
+ - normalize config vars for sf ([#543](https://github.com/forcedotcom/sfdx-core/issues/543)) ([93f3cbe](https://github.com/forcedotcom/sfdx-core/commit/93f3cbe90103fa159f21f532ffc173931037651c))
10
+
11
+ ### [3.10.1](https://github.com/forcedotcom/sfdx-core/compare/v3.10.0...v3.10.1) (2022-03-24)
12
+
13
+ ### Bug Fixes
14
+
15
+ - rotating file logs ([ef5df25](https://github.com/forcedotcom/sfdx-core/commit/ef5df25c17a67541d12d5c228c18b75775251d98))
16
+
17
+ ## [3.10.0](https://github.com/forcedotcom/sfdx-core/compare/v3.9.0...v3.10.0) (2022-03-23)
18
+
19
+ ### Features
20
+
21
+ - lifecycle events for scratch org create ([cba673b](https://github.com/forcedotcom/sfdx-core/commit/cba673b515df311165f3c392b155fcf5fbf9e2c6))
22
+ - scratch org lifecycle events ([541349d](https://github.com/forcedotcom/sfdx-core/commit/541349d84b4784356d8bc504d1e331450487b6ec))
23
+
24
+ ### Bug Fixes
25
+
26
+ - casing typo for import ([066a2bb](https://github.com/forcedotcom/sfdx-core/commit/066a2bbb37b07f62415f021ef511344976315128))
27
+ - warnings about tracking aren't a throw (org will still auth, default) ([38114a3](https://github.com/forcedotcom/sfdx-core/commit/38114a3526267a615fa8f5d3470b79c9b36a8fa8))
28
+
5
29
  ## [3.9.0](https://github.com/forcedotcom/sfdx-core/compare/v3.8.1...v3.9.0) (2022-03-21)
6
30
 
7
31
  ### Features
@@ -51,6 +51,20 @@ export interface ConfigPropertyMetaInput {
51
51
  */
52
52
  failedMessage: string | ((value: ConfigValue) => string);
53
53
  }
54
+ export declare enum SfConfigProperties {
55
+ /**
56
+ * Disables telemetry reporting
57
+ */
58
+ DISABLE_TELEMETRY = "disable-telemetry"
59
+ }
60
+ export declare const SF_ALLOWED_PROPERTIES: {
61
+ key: SfConfigProperties;
62
+ description: string;
63
+ input: {
64
+ validator: (value: ConfigValue) => boolean;
65
+ failedMessage: string;
66
+ };
67
+ }[];
54
68
  export declare enum SfdxPropertyKeys {
55
69
  /**
56
70
  * Username associated with the default dev hub org.
@@ -68,74 +82,112 @@ export declare enum SfdxPropertyKeys {
68
82
  DEFAULT_USERNAME = "defaultusername",
69
83
  /**
70
84
  * The sid for the debugger configuration.
85
+ *
86
+ * @deprecated Replaced by OrgConfigProperties.ORG_ISV_DEBUGGER_SID in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#config}
71
87
  */
72
88
  ISV_DEBUGGER_SID = "isvDebuggerSid",
73
89
  /**
74
90
  * The url for the debugger configuration.
91
+ *
92
+ * @deprecated Replaced by OrgConfigProperties.ORG_ISV_DEBUGGER_URL in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#config}
75
93
  */
76
94
  ISV_DEBUGGER_URL = "isvDebuggerUrl",
77
95
  /**
78
96
  * The api version
97
+ *
98
+ * @deprecated Replaced by OrgConfigProperties.ORG_API_VERSION in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#config}
79
99
  */
80
100
  API_VERSION = "apiVersion",
81
101
  /**
82
102
  * Disables telemetry reporting
103
+ *
104
+ * @deprecated Replaced by SfPropertyKeys.DISABLE_TELEMETRY in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#config}
83
105
  */
84
106
  DISABLE_TELEMETRY = "disableTelemetry",
85
107
  /**
86
108
  * Custom templates repo or local location.
109
+ *
110
+ * @deprecated Replaced by OrgConfigProperties.ORG_CUSTOM_METADATA_TEMPLATES in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#config}
87
111
  */
88
112
  CUSTOM_ORG_METADATA_TEMPLATES = "customOrgMetadataTemplates",
89
113
  /**
90
114
  * allows users to override the 10,000 result query limit
115
+ *
116
+ * @deprecated Replaced by OrgConfigProperties.ORG_MAX_QUERY_LIMIT in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#config}
91
117
  */
92
118
  MAX_QUERY_LIMIT = "maxQueryLimit",
93
- /** */
119
+ /**
120
+ * @deprecated
121
+ */
94
122
  REST_DEPLOY = "restDeploy",
95
- /** */
123
+ /**
124
+ * @deprecated Replaced by OrgConfigProperties.ORG_INSTANCE_URL in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#config}
125
+ */
96
126
  INSTANCE_URL = "instanceUrl"
97
127
  }
98
128
  export declare const SFDX_ALLOWED_PROPERTIES: ({
99
129
  key: SfdxPropertyKeys;
100
130
  description: string;
131
+ newKey: OrgConfigProperties;
132
+ deprecated: boolean;
101
133
  input: {
102
134
  validator: (value: ConfigValue) => boolean;
103
135
  failedMessage: string;
104
136
  };
137
+ encrypted?: undefined;
105
138
  hidden?: undefined;
106
- newKey?: undefined;
107
- deprecated?: undefined;
139
+ } | {
140
+ key: SfdxPropertyKeys;
141
+ newKey: OrgConfigProperties;
142
+ deprecated: boolean;
143
+ description: string;
144
+ input?: undefined;
108
145
  encrypted?: undefined;
146
+ hidden?: undefined;
109
147
  } | {
110
148
  key: SfdxPropertyKeys;
149
+ newKey: OrgConfigProperties;
150
+ deprecated: boolean;
111
151
  description: string;
112
- hidden: boolean;
152
+ encrypted: boolean;
113
153
  input: {
114
154
  validator: (value: ConfigValue) => boolean;
115
155
  failedMessage: string;
116
156
  };
117
- newKey?: undefined;
118
- deprecated?: undefined;
119
- encrypted?: undefined;
157
+ hidden?: undefined;
120
158
  } | {
121
159
  key: SfdxPropertyKeys;
122
- newKey: OrgConfigProperties;
160
+ newKey: SfConfigProperties;
123
161
  deprecated: boolean;
124
162
  description: string;
125
- input?: undefined;
163
+ input: {
164
+ validator: (value: ConfigValue) => boolean;
165
+ failedMessage: string;
166
+ };
167
+ encrypted?: undefined;
126
168
  hidden?: undefined;
169
+ } | {
170
+ key: SfdxPropertyKeys;
171
+ description: string;
172
+ hidden: boolean;
173
+ newKey: string;
174
+ deprecated: boolean;
175
+ input: {
176
+ validator: (value: ConfigValue) => boolean;
177
+ failedMessage: string;
178
+ };
127
179
  encrypted?: undefined;
128
180
  } | {
129
181
  key: SfdxPropertyKeys;
130
182
  description: string;
131
- encrypted: boolean;
183
+ hidden: boolean;
184
+ newKey: OrgConfigProperties;
132
185
  input: {
133
186
  validator: (value: ConfigValue) => boolean;
134
187
  failedMessage: string;
135
188
  };
136
- hidden?: undefined;
137
- newKey?: undefined;
138
189
  deprecated?: undefined;
190
+ encrypted?: undefined;
139
191
  })[];
140
192
  export declare const SfProperty: {
141
193
  [index: string]: ConfigPropertyMeta;
@@ -6,7 +6,7 @@
6
6
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.Config = exports.SfProperty = exports.SFDX_ALLOWED_PROPERTIES = exports.SfdxPropertyKeys = void 0;
9
+ exports.Config = exports.SfProperty = exports.SFDX_ALLOWED_PROPERTIES = exports.SfdxPropertyKeys = exports.SF_ALLOWED_PROPERTIES = exports.SfConfigProperties = void 0;
10
10
  const path_1 = require("path");
11
11
  const fs = require("fs");
12
12
  const kit_1 = require("@salesforce/kit");
@@ -40,10 +40,28 @@ const messages = messages_1.Messages.load('@salesforce/core', 'config', [
40
40
  'maxQueryLimit',
41
41
  'restDeploy',
42
42
  'instanceUrl',
43
+ 'disable-telemetry',
43
44
  ]);
44
45
  const log = logger_1.Logger.childFromRoot('core:config');
45
46
  const SFDX_CONFIG_FILE_NAME = 'sfdx-config.json';
46
47
  const CONFIG_FILE_NAME = 'config.json';
48
+ var SfConfigProperties;
49
+ (function (SfConfigProperties) {
50
+ /**
51
+ * Disables telemetry reporting
52
+ */
53
+ SfConfigProperties["DISABLE_TELEMETRY"] = "disable-telemetry";
54
+ })(SfConfigProperties = exports.SfConfigProperties || (exports.SfConfigProperties = {}));
55
+ exports.SF_ALLOWED_PROPERTIES = [
56
+ {
57
+ key: SfConfigProperties.DISABLE_TELEMETRY,
58
+ description: messages.getMessage(SfConfigProperties.DISABLE_TELEMETRY),
59
+ input: {
60
+ validator: (value) => value == null || ['true', 'false'].includes(value.toString()),
61
+ failedMessage: messages.getMessage('invalidBooleanConfigValue'),
62
+ },
63
+ },
64
+ ];
47
65
  var SfdxPropertyKeys;
48
66
  (function (SfdxPropertyKeys) {
49
67
  /**
@@ -62,37 +80,55 @@ var SfdxPropertyKeys;
62
80
  SfdxPropertyKeys["DEFAULT_USERNAME"] = "defaultusername";
63
81
  /**
64
82
  * The sid for the debugger configuration.
83
+ *
84
+ * @deprecated Replaced by OrgConfigProperties.ORG_ISV_DEBUGGER_SID in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#config}
65
85
  */
66
86
  SfdxPropertyKeys["ISV_DEBUGGER_SID"] = "isvDebuggerSid";
67
87
  /**
68
88
  * The url for the debugger configuration.
89
+ *
90
+ * @deprecated Replaced by OrgConfigProperties.ORG_ISV_DEBUGGER_URL in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#config}
69
91
  */
70
92
  SfdxPropertyKeys["ISV_DEBUGGER_URL"] = "isvDebuggerUrl";
71
93
  /**
72
94
  * The api version
95
+ *
96
+ * @deprecated Replaced by OrgConfigProperties.ORG_API_VERSION in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#config}
73
97
  */
74
98
  SfdxPropertyKeys["API_VERSION"] = "apiVersion";
75
99
  /**
76
100
  * Disables telemetry reporting
101
+ *
102
+ * @deprecated Replaced by SfPropertyKeys.DISABLE_TELEMETRY in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#config}
77
103
  */
78
104
  SfdxPropertyKeys["DISABLE_TELEMETRY"] = "disableTelemetry";
79
105
  /**
80
106
  * Custom templates repo or local location.
107
+ *
108
+ * @deprecated Replaced by OrgConfigProperties.ORG_CUSTOM_METADATA_TEMPLATES in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#config}
81
109
  */
82
110
  SfdxPropertyKeys["CUSTOM_ORG_METADATA_TEMPLATES"] = "customOrgMetadataTemplates";
83
111
  /**
84
112
  * allows users to override the 10,000 result query limit
113
+ *
114
+ * @deprecated Replaced by OrgConfigProperties.ORG_MAX_QUERY_LIMIT in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#config}
85
115
  */
86
116
  SfdxPropertyKeys["MAX_QUERY_LIMIT"] = "maxQueryLimit";
87
- /** */
117
+ /**
118
+ * @deprecated
119
+ */
88
120
  SfdxPropertyKeys["REST_DEPLOY"] = "restDeploy";
89
- /** */
121
+ /**
122
+ * @deprecated Replaced by OrgConfigProperties.ORG_INSTANCE_URL in v3 {@link https://github.com/forcedotcom/sfdx-core/blob/v3/MIGRATING_V2-V3.md#config}
123
+ */
90
124
  SfdxPropertyKeys["INSTANCE_URL"] = "instanceUrl";
91
125
  })(SfdxPropertyKeys = exports.SfdxPropertyKeys || (exports.SfdxPropertyKeys = {}));
92
126
  exports.SFDX_ALLOWED_PROPERTIES = [
93
127
  {
94
128
  key: SfdxPropertyKeys.INSTANCE_URL,
95
129
  description: messages.getMessage(SfdxPropertyKeys.INSTANCE_URL),
130
+ newKey: orgConfigProperties_1.OrgConfigProperties.ORG_INSTANCE_URL,
131
+ deprecated: true,
96
132
  input: {
97
133
  // If a value is provided validate it otherwise no value is unset.
98
134
  validator: (value) => {
@@ -109,6 +145,8 @@ exports.SFDX_ALLOWED_PROPERTIES = [
109
145
  },
110
146
  {
111
147
  key: SfdxPropertyKeys.API_VERSION,
148
+ newKey: orgConfigProperties_1.OrgConfigProperties.ORG_API_VERSION,
149
+ deprecated: true,
112
150
  description: messages.getMessage(SfdxPropertyKeys.API_VERSION),
113
151
  hidden: true,
114
152
  input: {
@@ -133,6 +171,8 @@ exports.SFDX_ALLOWED_PROPERTIES = [
133
171
  },
134
172
  {
135
173
  key: SfdxPropertyKeys.ISV_DEBUGGER_SID,
174
+ newKey: orgConfigProperties_1.OrgConfigProperties.ORG_ISV_DEBUGGER_SID,
175
+ deprecated: true,
136
176
  description: messages.getMessage(SfdxPropertyKeys.ISV_DEBUGGER_SID),
137
177
  encrypted: true,
138
178
  input: {
@@ -143,6 +183,8 @@ exports.SFDX_ALLOWED_PROPERTIES = [
143
183
  },
144
184
  {
145
185
  key: SfdxPropertyKeys.ISV_DEBUGGER_URL,
186
+ newKey: orgConfigProperties_1.OrgConfigProperties.ORG_ISV_DEBUGGER_URL,
187
+ deprecated: true,
146
188
  description: messages.getMessage(SfdxPropertyKeys.ISV_DEBUGGER_URL),
147
189
  input: {
148
190
  // If a value is provided validate it otherwise no value is unset.
@@ -152,17 +194,20 @@ exports.SFDX_ALLOWED_PROPERTIES = [
152
194
  },
153
195
  {
154
196
  key: SfdxPropertyKeys.DISABLE_TELEMETRY,
197
+ newKey: SfConfigProperties.DISABLE_TELEMETRY,
198
+ deprecated: true,
155
199
  description: messages.getMessage(SfdxPropertyKeys.DISABLE_TELEMETRY),
156
200
  input: {
157
201
  validator: (value) => value == null || ['true', 'false'].includes(value.toString()),
158
202
  failedMessage: messages.getMessage('invalidBooleanConfigValue'),
159
203
  },
160
204
  },
161
- // This should be brought in by a plugin, but there isn't a way to do that right now.
162
205
  {
163
206
  key: SfdxPropertyKeys.REST_DEPLOY,
164
207
  description: messages.getMessage(SfdxPropertyKeys.REST_DEPLOY),
165
208
  hidden: true,
209
+ newKey: 'org-metadata-rest-deploy',
210
+ deprecated: true,
166
211
  input: {
167
212
  validator: (value) => value != null && ['true', 'false'].includes(value.toString()),
168
213
  failedMessage: messages.getMessage('invalidBooleanConfigValue'),
@@ -171,6 +216,8 @@ exports.SFDX_ALLOWED_PROPERTIES = [
171
216
  {
172
217
  key: SfdxPropertyKeys.MAX_QUERY_LIMIT,
173
218
  description: messages.getMessage(SfdxPropertyKeys.MAX_QUERY_LIMIT),
219
+ hidden: true,
220
+ newKey: orgConfigProperties_1.OrgConfigProperties.ORG_MAX_QUERY_LIMIT,
174
221
  input: {
175
222
  // the bit shift will remove the negative bit, and any decimal numbers
176
223
  // then the parseFloat will handle converting it to a number from a string
@@ -420,6 +467,7 @@ class Config extends configFile_1.ConfigFile {
420
467
  exports.Config = Config;
421
468
  Config.allowedProperties = [
422
469
  ...exports.SFDX_ALLOWED_PROPERTIES,
470
+ ...exports.SF_ALLOWED_PROPERTIES,
423
471
  ...orgConfigProperties_1.ORG_CONFIG_ALLOWED_PROPERTIES,
424
472
  ];
425
473
  class SfdxConfig {
@@ -26,6 +26,8 @@ export declare enum EnvironmentVariable {
26
26
  'SFDX_INSTANCE_URL' = "SFDX_INSTANCE_URL",
27
27
  'SFDX_JSON_TO_STDOUT' = "SFDX_JSON_TO_STDOUT",
28
28
  'SFDX_LOG_LEVEL' = "SFDX_LOG_LEVEL",
29
+ 'SFDX_LOG_ROTATION_COUNT' = "SFDX_LOG_ROTATION_COUNT",
30
+ 'SFDX_LOG_ROTATION_PERIOD' = "SFDX_LOG_ROTATION_PERIOD",
29
31
  'SFDX_MAX_QUERY_LIMIT' = "SFDX_MAX_QUERY_LIMIT",
30
32
  'SFDX_MDAPI_TEMP_DIR' = "SFDX_MDAPI_TEMP_DIR",
31
33
  'SFDX_NPM_REGISTRY' = "SFDX_NPM_REGISTRY",
@@ -44,7 +46,7 @@ export declare enum EnvironmentVariable {
44
46
  'SF_TARGET_ORG' = "SF_TARGET_ORG",
45
47
  'SF_TARGET_DEV_HUB' = "SF_TARGET_DEV_HUB",
46
48
  'SF_ACCESS_TOKEN' = "SF_ACCESS_TOKEN",
47
- 'SF_API_VERSION' = "SF_API_VERSION",
49
+ 'SF_ORG_API_VERSION' = "SF_ORG_API_VERSION",
48
50
  'SF_AUDIENCE_URL' = "SF_AUDIENCE_URL",
49
51
  'SF_CODE_COVERAGE_REQUIREMENT' = "SF_CODE_COVERAGE_REQUIREMENT",
50
52
  'SF_CONTENT_TYPE' = "SF_CONTENT_TYPE",
@@ -55,10 +57,12 @@ export declare enum EnvironmentVariable {
55
57
  'SF_DNS_TIMEOUT' = "SF_DNS_TIMEOUT",
56
58
  'SF_DOMAIN_RETRY' = "SF_DOMAIN_RETRY",
57
59
  'SF_IMPROVED_CODE_COVERAGE' = "SF_IMPROVED_CODE_COVERAGE",
58
- 'SF_INSTANCE_URL' = "SF_INSTANCE_URL",
60
+ 'SF_ORG_INSTANCE_URL' = "SF_ORG_INSTANCE_URL",
59
61
  'SF_JSON_TO_STDOUT' = "SF_JSON_TO_STDOUT",
60
62
  'SF_LOG_LEVEL' = "SF_LOG_LEVEL",
61
- 'SF_MAX_QUERY_LIMIT' = "SF_MAX_QUERY_LIMIT",
63
+ 'SF_LOG_ROTATION_COUNT' = "SF_LOG_ROTATION_COUNT",
64
+ 'SF_LOG_ROTATION_PERIOD' = "SF_LOG_ROTATION_PERIOD",
65
+ 'SF_ORG_MAX_QUERY_LIMIT' = "SF_ORG_MAX_QUERY_LIMIT",
62
66
  'SF_MDAPI_TEMP_DIR' = "SF_MDAPI_TEMP_DIR",
63
67
  'SF_NPM_REGISTRY' = "SF_NPM_REGISTRY",
64
68
  'SF_PRECOMPILE_ENABLE' = "SF_PRECOMPILE_ENABLE",
@@ -40,6 +40,8 @@ var EnvironmentVariable;
40
40
  EnvironmentVariable["SFDX_INSTANCE_URL"] = "SFDX_INSTANCE_URL";
41
41
  EnvironmentVariable["SFDX_JSON_TO_STDOUT"] = "SFDX_JSON_TO_STDOUT";
42
42
  EnvironmentVariable["SFDX_LOG_LEVEL"] = "SFDX_LOG_LEVEL";
43
+ EnvironmentVariable["SFDX_LOG_ROTATION_COUNT"] = "SFDX_LOG_ROTATION_COUNT";
44
+ EnvironmentVariable["SFDX_LOG_ROTATION_PERIOD"] = "SFDX_LOG_ROTATION_PERIOD";
43
45
  EnvironmentVariable["SFDX_MAX_QUERY_LIMIT"] = "SFDX_MAX_QUERY_LIMIT";
44
46
  EnvironmentVariable["SFDX_MDAPI_TEMP_DIR"] = "SFDX_MDAPI_TEMP_DIR";
45
47
  EnvironmentVariable["SFDX_NPM_REGISTRY"] = "SFDX_NPM_REGISTRY";
@@ -58,7 +60,7 @@ var EnvironmentVariable;
58
60
  EnvironmentVariable["SF_TARGET_ORG"] = "SF_TARGET_ORG";
59
61
  EnvironmentVariable["SF_TARGET_DEV_HUB"] = "SF_TARGET_DEV_HUB";
60
62
  EnvironmentVariable["SF_ACCESS_TOKEN"] = "SF_ACCESS_TOKEN";
61
- EnvironmentVariable["SF_API_VERSION"] = "SF_API_VERSION";
63
+ EnvironmentVariable["SF_ORG_API_VERSION"] = "SF_ORG_API_VERSION";
62
64
  EnvironmentVariable["SF_AUDIENCE_URL"] = "SF_AUDIENCE_URL";
63
65
  EnvironmentVariable["SF_CODE_COVERAGE_REQUIREMENT"] = "SF_CODE_COVERAGE_REQUIREMENT";
64
66
  EnvironmentVariable["SF_CONTENT_TYPE"] = "SF_CONTENT_TYPE";
@@ -69,10 +71,12 @@ var EnvironmentVariable;
69
71
  EnvironmentVariable["SF_DNS_TIMEOUT"] = "SF_DNS_TIMEOUT";
70
72
  EnvironmentVariable["SF_DOMAIN_RETRY"] = "SF_DOMAIN_RETRY";
71
73
  EnvironmentVariable["SF_IMPROVED_CODE_COVERAGE"] = "SF_IMPROVED_CODE_COVERAGE";
72
- EnvironmentVariable["SF_INSTANCE_URL"] = "SF_INSTANCE_URL";
74
+ EnvironmentVariable["SF_ORG_INSTANCE_URL"] = "SF_ORG_INSTANCE_URL";
73
75
  EnvironmentVariable["SF_JSON_TO_STDOUT"] = "SF_JSON_TO_STDOUT";
74
76
  EnvironmentVariable["SF_LOG_LEVEL"] = "SF_LOG_LEVEL";
75
- EnvironmentVariable["SF_MAX_QUERY_LIMIT"] = "SF_MAX_QUERY_LIMIT";
77
+ EnvironmentVariable["SF_LOG_ROTATION_COUNT"] = "SF_LOG_ROTATION_COUNT";
78
+ EnvironmentVariable["SF_LOG_ROTATION_PERIOD"] = "SF_LOG_ROTATION_PERIOD";
79
+ EnvironmentVariable["SF_ORG_MAX_QUERY_LIMIT"] = "SF_ORG_MAX_QUERY_LIMIT";
76
80
  EnvironmentVariable["SF_MDAPI_TEMP_DIR"] = "SF_MDAPI_TEMP_DIR";
77
81
  EnvironmentVariable["SF_NPM_REGISTRY"] = "SF_NPM_REGISTRY";
78
82
  EnvironmentVariable["SF_PRECOMPILE_ENABLE"] = "SF_PRECOMPILE_ENABLE";
@@ -124,7 +128,7 @@ exports.SUPPORTED_ENV_VARS = {
124
128
  },
125
129
  [EnvironmentVariable.SFDX_API_VERSION]: {
126
130
  description: getMessage(EnvironmentVariable.SFDX_API_VERSION),
127
- synonymOf: EnvironmentVariable.SF_API_VERSION,
131
+ synonymOf: EnvironmentVariable.SF_ORG_API_VERSION,
128
132
  },
129
133
  [EnvironmentVariable.SFDX_AUDIENCE_URL]: {
130
134
  description: getMessage(EnvironmentVariable.SFDX_AUDIENCE_URL),
@@ -176,7 +180,7 @@ exports.SUPPORTED_ENV_VARS = {
176
180
  },
177
181
  [EnvironmentVariable.SFDX_INSTANCE_URL]: {
178
182
  description: getMessage(EnvironmentVariable.SFDX_INSTANCE_URL),
179
- synonymOf: EnvironmentVariable.SF_INSTANCE_URL,
183
+ synonymOf: EnvironmentVariable.SF_ORG_INSTANCE_URL,
180
184
  },
181
185
  [EnvironmentVariable.SFDX_JSON_TO_STDOUT]: {
182
186
  description: getMessage(EnvironmentVariable.SFDX_JSON_TO_STDOUT),
@@ -186,9 +190,17 @@ exports.SUPPORTED_ENV_VARS = {
186
190
  description: getMessage(EnvironmentVariable.SFDX_LOG_LEVEL),
187
191
  synonymOf: EnvironmentVariable.SF_LOG_LEVEL,
188
192
  },
193
+ [EnvironmentVariable.SFDX_LOG_ROTATION_COUNT]: {
194
+ description: getMessage(EnvironmentVariable.SFDX_LOG_ROTATION_COUNT),
195
+ synonymOf: EnvironmentVariable.SF_LOG_ROTATION_COUNT,
196
+ },
197
+ [EnvironmentVariable.SFDX_LOG_ROTATION_PERIOD]: {
198
+ description: getMessage(EnvironmentVariable.SFDX_LOG_ROTATION_PERIOD),
199
+ synonymOf: EnvironmentVariable.SF_LOG_ROTATION_PERIOD,
200
+ },
189
201
  [EnvironmentVariable.SFDX_MAX_QUERY_LIMIT]: {
190
202
  description: getMessage(EnvironmentVariable.SFDX_MAX_QUERY_LIMIT),
191
- synonymOf: EnvironmentVariable.SF_MAX_QUERY_LIMIT,
203
+ synonymOf: EnvironmentVariable.SF_ORG_MAX_QUERY_LIMIT,
192
204
  },
193
205
  [EnvironmentVariable.SFDX_MDAPI_TEMP_DIR]: {
194
206
  description: getMessage(EnvironmentVariable.SFDX_MDAPI_TEMP_DIR),
@@ -259,8 +271,8 @@ exports.SUPPORTED_ENV_VARS = {
259
271
  description: getMessage(EnvironmentVariable.SF_ACCESS_TOKEN),
260
272
  synonymOf: null,
261
273
  },
262
- [EnvironmentVariable.SF_API_VERSION]: {
263
- description: getMessage(EnvironmentVariable.SF_API_VERSION),
274
+ [EnvironmentVariable.SF_ORG_API_VERSION]: {
275
+ description: getMessage(EnvironmentVariable.SF_ORG_API_VERSION),
264
276
  synonymOf: null,
265
277
  },
266
278
  [EnvironmentVariable.SF_AUDIENCE_URL]: {
@@ -303,8 +315,8 @@ exports.SUPPORTED_ENV_VARS = {
303
315
  description: getMessage(EnvironmentVariable.SF_IMPROVED_CODE_COVERAGE),
304
316
  synonymOf: null,
305
317
  },
306
- [EnvironmentVariable.SF_INSTANCE_URL]: {
307
- description: getMessage(EnvironmentVariable.SF_INSTANCE_URL),
318
+ [EnvironmentVariable.SF_ORG_INSTANCE_URL]: {
319
+ description: getMessage(EnvironmentVariable.SF_ORG_INSTANCE_URL),
308
320
  synonymOf: null,
309
321
  },
310
322
  [EnvironmentVariable.SF_JSON_TO_STDOUT]: {
@@ -315,8 +327,16 @@ exports.SUPPORTED_ENV_VARS = {
315
327
  description: getMessage(EnvironmentVariable.SF_LOG_LEVEL),
316
328
  synonymOf: null,
317
329
  },
318
- [EnvironmentVariable.SF_MAX_QUERY_LIMIT]: {
319
- description: getMessage(EnvironmentVariable.SF_MAX_QUERY_LIMIT),
330
+ [EnvironmentVariable.SF_LOG_ROTATION_COUNT]: {
331
+ description: getMessage(EnvironmentVariable.SF_LOG_ROTATION_COUNT),
332
+ synonymOf: null,
333
+ },
334
+ [EnvironmentVariable.SF_LOG_ROTATION_PERIOD]: {
335
+ description: getMessage(EnvironmentVariable.SF_LOG_ROTATION_PERIOD),
336
+ synonymOf: null,
337
+ },
338
+ [EnvironmentVariable.SF_ORG_MAX_QUERY_LIMIT]: {
339
+ description: getMessage(EnvironmentVariable.SF_ORG_MAX_QUERY_LIMIT),
320
340
  synonymOf: null,
321
341
  },
322
342
  [EnvironmentVariable.SF_MDAPI_TEMP_DIR]: {
package/lib/exported.d.ts CHANGED
@@ -6,7 +6,7 @@ export { BaseConfigStore, ConfigContents, ConfigEntry, ConfigStore, ConfigValue
6
6
  export { GlobalInfo, SfEntry, SfInfo, SfInfoKeys, SfOrg, SfOrgs, SfToken, SfTokens } from './globalInfo';
7
7
  export { DeviceOauthService, DeviceCodeResponse, DeviceCodePollingResponse } from './deviceOauthService';
8
8
  export { OrgUsersConfig } from './config/orgUsersConfig';
9
- export { ConfigPropertyMeta, ConfigPropertyMetaInput, Config, SfdxPropertyKeys, SFDX_ALLOWED_PROPERTIES, } from './config/config';
9
+ export { ConfigPropertyMeta, ConfigPropertyMetaInput, Config, SfdxPropertyKeys, SfConfigProperties, SFDX_ALLOWED_PROPERTIES, SF_ALLOWED_PROPERTIES, } from './config/config';
10
10
  export { ConfigInfo, ConfigAggregator } from './config/configAggregator';
11
11
  export { AuthFields, AuthInfo, AuthSideEffects, OrgAuthorization } from './org/authInfo';
12
12
  export { AuthRemover } from './org/authRemover';
@@ -30,6 +30,7 @@ export { MyDomainResolver } from './status/myDomainResolver';
30
30
  export { DefaultUserFields, REQUIRED_FIELDS, User, UserFields } from './org/user';
31
31
  export { PermissionSetAssignment, PermissionSetAssignmentFields } from './org/permissionSetAssignment';
32
32
  export { ScratchOrgCreateOptions, ScratchOrgCreateResult, scratchOrgCreate } from './org/scratchOrgCreate';
33
- export { ScratchOrgInfo } from './org/scratchOrgInfoApi';
33
+ export { ScratchOrgInfo } from './org/scratchOrgTypes';
34
+ export { ScratchOrgLifecycleEvent, scratchOrgLifecycleEventName, scratchOrgLifecycleStages, } from './org/scratchOrgLifecycleEvents';
34
35
  export * from './util/sfdc';
35
36
  export * from './util/sfdcUrl';
package/lib/exported.js CHANGED
@@ -16,7 +16,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
17
17
  };
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.scratchOrgCreate = exports.PermissionSetAssignment = exports.User = exports.REQUIRED_FIELDS = exports.DefaultUserFields = exports.MyDomainResolver = exports.StreamingClient = exports.CometClient = exports.PollingClient = exports.SfdxError = exports.SfError = exports.SchemaValidator = exports.SchemaPrinter = exports.SfdxProjectJson = exports.SfdxProject = exports.SfProjectJson = exports.SfProject = exports.ORG_CONFIG_ALLOWED_PROPERTIES = exports.OrgConfigProperties = exports.OrgTypes = exports.SandboxEvents = exports.Org = exports.Messages = exports.Logger = exports.LoggerLevel = exports.getJwtAudienceUrl = exports.SfdcUrl = exports.WebOAuthServer = exports.Lifecycle = exports.Global = exports.Mode = exports.SFDX_HTTP_HEADERS = exports.Connection = exports.AuthRemover = exports.AuthInfo = exports.ConfigAggregator = exports.SFDX_ALLOWED_PROPERTIES = exports.SfdxPropertyKeys = exports.Config = exports.OrgUsersConfig = exports.DeviceOauthService = exports.SfInfoKeys = exports.GlobalInfo = exports.BaseConfigStore = exports.EnvVars = exports.SUPPORTED_ENV_VARS = exports.EnvironmentVariable = exports.envVars = exports.TTLConfig = exports.ConfigFile = void 0;
19
+ exports.User = exports.REQUIRED_FIELDS = exports.DefaultUserFields = exports.MyDomainResolver = exports.StreamingClient = exports.CometClient = exports.PollingClient = exports.SfdxError = exports.SfError = exports.SchemaValidator = exports.SchemaPrinter = exports.SfdxProjectJson = exports.SfdxProject = exports.SfProjectJson = exports.SfProject = exports.ORG_CONFIG_ALLOWED_PROPERTIES = exports.OrgConfigProperties = exports.OrgTypes = exports.SandboxEvents = exports.Org = exports.Messages = exports.Logger = exports.LoggerLevel = exports.getJwtAudienceUrl = exports.SfdcUrl = exports.WebOAuthServer = exports.Lifecycle = exports.Global = exports.Mode = exports.SFDX_HTTP_HEADERS = exports.Connection = exports.AuthRemover = exports.AuthInfo = exports.ConfigAggregator = exports.SF_ALLOWED_PROPERTIES = exports.SFDX_ALLOWED_PROPERTIES = exports.SfConfigProperties = exports.SfdxPropertyKeys = exports.Config = exports.OrgUsersConfig = exports.DeviceOauthService = exports.SfInfoKeys = exports.GlobalInfo = exports.BaseConfigStore = exports.EnvVars = exports.SUPPORTED_ENV_VARS = exports.EnvironmentVariable = exports.envVars = exports.TTLConfig = exports.ConfigFile = void 0;
20
+ exports.scratchOrgLifecycleStages = exports.scratchOrgLifecycleEventName = exports.scratchOrgCreate = exports.PermissionSetAssignment = void 0;
20
21
  const messages_1 = require("./messages");
21
22
  messages_1.Messages.importMessagesDirectory(__dirname);
22
23
  var configFile_1 = require("./config/configFile");
@@ -40,7 +41,9 @@ Object.defineProperty(exports, "OrgUsersConfig", { enumerable: true, get: functi
40
41
  var config_1 = require("./config/config");
41
42
  Object.defineProperty(exports, "Config", { enumerable: true, get: function () { return config_1.Config; } });
42
43
  Object.defineProperty(exports, "SfdxPropertyKeys", { enumerable: true, get: function () { return config_1.SfdxPropertyKeys; } });
44
+ Object.defineProperty(exports, "SfConfigProperties", { enumerable: true, get: function () { return config_1.SfConfigProperties; } });
43
45
  Object.defineProperty(exports, "SFDX_ALLOWED_PROPERTIES", { enumerable: true, get: function () { return config_1.SFDX_ALLOWED_PROPERTIES; } });
46
+ Object.defineProperty(exports, "SF_ALLOWED_PROPERTIES", { enumerable: true, get: function () { return config_1.SF_ALLOWED_PROPERTIES; } });
44
47
  var configAggregator_1 = require("./config/configAggregator");
45
48
  Object.defineProperty(exports, "ConfigAggregator", { enumerable: true, get: function () { return configAggregator_1.ConfigAggregator; } });
46
49
  var authInfo_1 = require("./org/authInfo");
@@ -100,6 +103,9 @@ var permissionSetAssignment_1 = require("./org/permissionSetAssignment");
100
103
  Object.defineProperty(exports, "PermissionSetAssignment", { enumerable: true, get: function () { return permissionSetAssignment_1.PermissionSetAssignment; } });
101
104
  var scratchOrgCreate_1 = require("./org/scratchOrgCreate");
102
105
  Object.defineProperty(exports, "scratchOrgCreate", { enumerable: true, get: function () { return scratchOrgCreate_1.scratchOrgCreate; } });
106
+ var scratchOrgLifecycleEvents_1 = require("./org/scratchOrgLifecycleEvents");
107
+ Object.defineProperty(exports, "scratchOrgLifecycleEventName", { enumerable: true, get: function () { return scratchOrgLifecycleEvents_1.scratchOrgLifecycleEventName; } });
108
+ Object.defineProperty(exports, "scratchOrgLifecycleStages", { enumerable: true, get: function () { return scratchOrgLifecycleEvents_1.scratchOrgLifecycleStages; } });
103
109
  // Utility sub-modules
104
110
  __exportStar(require("./util/sfdc"), exports);
105
111
  __exportStar(require("./util/sfdcUrl"), exports);
package/lib/logger.d.ts CHANGED
@@ -163,6 +163,17 @@ export declare class Logger {
163
163
  static readonly LEVEL_NAMES: string[];
164
164
  private static readonly lifecycle;
165
165
  private static rootLogger?;
166
+ /**
167
+ * The default rotation period for logs. Example '1d' will rotate logs daily (at midnight).
168
+ * See 'period' docs here: https://github.com/forcedotcom/node-bunyan#stream-type-rotating-file
169
+ */
170
+ readonly logRotationPeriod: string;
171
+ /**
172
+ * The number of backup rotated log files to keep.
173
+ * Example: '3' will have the base sf.log file, and the past 3 (period) log files.
174
+ * See 'count' docs here: https://github.com/forcedotcom/node-bunyan#stream-type-rotating-file
175
+ */
176
+ readonly logRotationCount: number;
166
177
  /**
167
178
  * Whether debug is enabled for this Logger.
168
179
  */
package/lib/logger.js CHANGED
@@ -74,6 +74,17 @@ class Logger {
74
74
  * `Logger`.
75
75
  */
76
76
  constructor(optionsOrName) {
77
+ /**
78
+ * The default rotation period for logs. Example '1d' will rotate logs daily (at midnight).
79
+ * See 'period' docs here: https://github.com/forcedotcom/node-bunyan#stream-type-rotating-file
80
+ */
81
+ this.logRotationPeriod = new kit_1.Env().getString('SF_LOG_ROTATION_PERIOD') || '1d';
82
+ /**
83
+ * The number of backup rotated log files to keep.
84
+ * Example: '3' will have the base sf.log file, and the past 3 (period) log files.
85
+ * See 'count' docs here: https://github.com/forcedotcom/node-bunyan#stream-type-rotating-file
86
+ */
87
+ this.logRotationCount = new kit_1.Env().getNumber('SF_LOG_ROTATION_COUNT') || 2;
77
88
  /**
78
89
  * Whether debug is enabled for this Logger.
79
90
  */
@@ -252,12 +263,12 @@ class Logger {
252
263
  if (!this.bunyan.streams.find(
253
264
  // No bunyan typings
254
265
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
255
- (stream) => stream.type === 'file' && stream.path === logFile)) {
256
- // TODO: rotating-file
257
- // https://github.com/trentm/node-bunyan#stream-type-rotating-file
266
+ (stream) => stream.type === 'rotating-file' && stream.path === logFile)) {
258
267
  this.addStream({
259
- type: 'file',
268
+ type: 'rotating-file',
260
269
  path: logFile,
270
+ period: this.logRotationPeriod,
271
+ count: this.logRotationCount,
261
272
  level: this.bunyan.level(),
262
273
  });
263
274
  }
@@ -292,12 +303,12 @@ class Logger {
292
303
  if (!this.bunyan.streams.find(
293
304
  // No bunyan typings
294
305
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
295
- (stream) => stream.type === 'file' && stream.path === logFile)) {
296
- // TODO: rotating-file
297
- // https://github.com/trentm/node-bunyan#stream-type-rotating-file
306
+ (stream) => stream.type === 'rotating-file' && stream.path === logFile)) {
298
307
  this.addStream({
299
- type: 'file',
308
+ type: 'rotating-file',
300
309
  path: logFile,
310
+ period: this.logRotationPeriod,
311
+ count: this.logRotationCount,
301
312
  level: this.bunyan.level(),
302
313
  });
303
314
  }
@@ -1,8 +1,69 @@
1
+ import { ConfigValue } from '../config/configStore';
1
2
  export declare enum OrgConfigProperties {
3
+ /**
4
+ * Username associate with the default org.
5
+ */
2
6
  TARGET_ORG = "target-org",
3
- TARGET_DEV_HUB = "target-dev-hub"
7
+ /**
8
+ * Username associated with the default dev hub org.
9
+ */
10
+ TARGET_DEV_HUB = "target-dev-hub",
11
+ /**
12
+ * The api version
13
+ */
14
+ ORG_API_VERSION = "org-api-version",
15
+ /**
16
+ * Custom templates repo or local location.
17
+ */
18
+ ORG_CUSTOM_METADATA_TEMPLATES = "org-custom-metadata-templates",
19
+ /**
20
+ * Allows users to override the 10,000 result query limit.
21
+ */
22
+ ORG_MAX_QUERY_LIMIT = "org-max-query-limit",
23
+ /**
24
+ * The instance url of the org.
25
+ */
26
+ ORG_INSTANCE_URL = "org-instance-url",
27
+ /**
28
+ * The sid for the debugger configuration.
29
+ */
30
+ ORG_ISV_DEBUGGER_SID = "org-isv-debugger-sid",
31
+ /**
32
+ * The url for the debugger configuration.
33
+ */
34
+ ORG_ISV_DEBUGGER_URL = "org-isv-debugger-url"
4
35
  }
5
- export declare const ORG_CONFIG_ALLOWED_PROPERTIES: {
36
+ export declare const ORG_CONFIG_ALLOWED_PROPERTIES: ({
6
37
  key: OrgConfigProperties;
7
38
  description: string;
8
- }[];
39
+ input?: undefined;
40
+ hidden?: undefined;
41
+ encrypted?: undefined;
42
+ } | {
43
+ key: OrgConfigProperties;
44
+ description: string;
45
+ input: {
46
+ validator: (value: ConfigValue) => boolean;
47
+ failedMessage: string;
48
+ };
49
+ hidden?: undefined;
50
+ encrypted?: undefined;
51
+ } | {
52
+ key: OrgConfigProperties;
53
+ description: string;
54
+ hidden: boolean;
55
+ input: {
56
+ validator: (value: ConfigValue) => boolean;
57
+ failedMessage: string;
58
+ };
59
+ encrypted?: undefined;
60
+ } | {
61
+ key: OrgConfigProperties;
62
+ description: string;
63
+ encrypted: boolean;
64
+ input: {
65
+ validator: (value: ConfigValue) => boolean;
66
+ failedMessage: string;
67
+ };
68
+ hidden?: undefined;
69
+ })[];
@@ -8,22 +8,125 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.ORG_CONFIG_ALLOWED_PROPERTIES = exports.OrgConfigProperties = void 0;
10
10
  const path_1 = require("path");
11
+ const ts_types_1 = require("@salesforce/ts-types");
11
12
  const messages_1 = require("../messages");
13
+ const sfdcUrl_1 = require("../util/sfdcUrl");
14
+ const sfdc_1 = require("../util/sfdc");
12
15
  messages_1.Messages.importMessagesDirectory((0, path_1.join)(__dirname));
13
- const messages = messages_1.Messages.load('@salesforce/core', 'config', ['targetOrg', 'targetDevHub']);
16
+ const messages = messages_1.Messages.load('@salesforce/core', 'config', [
17
+ 'invalidApiVersion',
18
+ 'invalidBooleanConfigValue',
19
+ 'invalidInstanceUrl',
20
+ 'invalidIsvDebuggerSid',
21
+ 'invalidIsvDebuggerUrl',
22
+ 'invalidNumberConfigValue',
23
+ 'org-api-version',
24
+ 'org-instance-url',
25
+ 'org-isv-debugger-sid',
26
+ 'org-isv-debugger-url',
27
+ 'org-max-query-limit',
28
+ 'target-dev-hub',
29
+ 'target-org',
30
+ ]);
14
31
  var OrgConfigProperties;
15
32
  (function (OrgConfigProperties) {
33
+ /**
34
+ * Username associate with the default org.
35
+ */
16
36
  OrgConfigProperties["TARGET_ORG"] = "target-org";
37
+ /**
38
+ * Username associated with the default dev hub org.
39
+ */
17
40
  OrgConfigProperties["TARGET_DEV_HUB"] = "target-dev-hub";
41
+ /**
42
+ * The api version
43
+ */
44
+ OrgConfigProperties["ORG_API_VERSION"] = "org-api-version";
45
+ /**
46
+ * Custom templates repo or local location.
47
+ */
48
+ OrgConfigProperties["ORG_CUSTOM_METADATA_TEMPLATES"] = "org-custom-metadata-templates";
49
+ /**
50
+ * Allows users to override the 10,000 result query limit.
51
+ */
52
+ OrgConfigProperties["ORG_MAX_QUERY_LIMIT"] = "org-max-query-limit";
53
+ /**
54
+ * The instance url of the org.
55
+ */
56
+ OrgConfigProperties["ORG_INSTANCE_URL"] = "org-instance-url";
57
+ /**
58
+ * The sid for the debugger configuration.
59
+ */
60
+ OrgConfigProperties["ORG_ISV_DEBUGGER_SID"] = "org-isv-debugger-sid";
61
+ /**
62
+ * The url for the debugger configuration.
63
+ */
64
+ OrgConfigProperties["ORG_ISV_DEBUGGER_URL"] = "org-isv-debugger-url";
18
65
  })(OrgConfigProperties = exports.OrgConfigProperties || (exports.OrgConfigProperties = {}));
19
66
  exports.ORG_CONFIG_ALLOWED_PROPERTIES = [
20
67
  {
21
68
  key: OrgConfigProperties.TARGET_ORG,
22
- description: messages.getMessage('targetOrg'),
69
+ description: messages.getMessage(OrgConfigProperties.TARGET_ORG),
23
70
  },
24
71
  {
25
72
  key: OrgConfigProperties.TARGET_DEV_HUB,
26
- description: messages.getMessage('targetDevHub'),
73
+ description: messages.getMessage(OrgConfigProperties.TARGET_DEV_HUB),
74
+ },
75
+ {
76
+ key: OrgConfigProperties.ORG_INSTANCE_URL,
77
+ description: messages.getMessage(OrgConfigProperties.ORG_INSTANCE_URL),
78
+ input: {
79
+ // If a value is provided validate it otherwise no value is unset.
80
+ validator: (value) => {
81
+ if (value == null)
82
+ return true;
83
+ // validate if the value is a string and is a valid url and is either a salesforce domain
84
+ // or an internal url.
85
+ return ((0, ts_types_1.isString)(value) &&
86
+ sfdcUrl_1.SfdcUrl.isValidUrl(value) &&
87
+ (new sfdcUrl_1.SfdcUrl(value).isSalesforceDomain() || new sfdcUrl_1.SfdcUrl(value).isInternalUrl()));
88
+ },
89
+ failedMessage: messages.getMessage('invalidInstanceUrl'),
90
+ },
91
+ },
92
+ {
93
+ key: OrgConfigProperties.ORG_API_VERSION,
94
+ description: messages.getMessage(OrgConfigProperties.ORG_API_VERSION),
95
+ hidden: true,
96
+ input: {
97
+ // If a value is provided validate it otherwise no value is unset.
98
+ validator: (value) => value == null || ((0, ts_types_1.isString)(value) && sfdc_1.sfdc.validateApiVersion(value)),
99
+ failedMessage: messages.getMessage('invalidApiVersion'),
100
+ },
101
+ },
102
+ {
103
+ key: OrgConfigProperties.ORG_ISV_DEBUGGER_SID,
104
+ description: messages.getMessage(OrgConfigProperties.ORG_ISV_DEBUGGER_SID),
105
+ encrypted: true,
106
+ input: {
107
+ // If a value is provided validate it otherwise no value is unset.
108
+ validator: (value) => value == null || (0, ts_types_1.isString)(value),
109
+ failedMessage: messages.getMessage('invalidIsvDebuggerSid'),
110
+ },
111
+ },
112
+ {
113
+ key: OrgConfigProperties.ORG_ISV_DEBUGGER_URL,
114
+ description: messages.getMessage(OrgConfigProperties.ORG_ISV_DEBUGGER_URL),
115
+ input: {
116
+ // If a value is provided validate it otherwise no value is unset.
117
+ validator: (value) => value == null || (0, ts_types_1.isString)(value),
118
+ failedMessage: messages.getMessage('invalidIsvDebuggerUrl'),
119
+ },
120
+ },
121
+ {
122
+ key: OrgConfigProperties.ORG_MAX_QUERY_LIMIT,
123
+ description: messages.getMessage(OrgConfigProperties.ORG_MAX_QUERY_LIMIT),
124
+ input: {
125
+ // the bit shift will remove the negative bit, and any decimal numbers
126
+ // then the parseFloat will handle converting it to a number from a string
127
+ validator: (value) => value >>> 0 === parseFloat(value) && value > 0,
128
+ failedMessage: messages.getMessage('invalidNumberConfigValue'),
129
+ },
27
130
  },
28
131
  ];
29
132
  //# sourceMappingURL=orgConfigProperties.js.map
@@ -1,6 +1,6 @@
1
1
  import { Duration } from '@salesforce/kit';
2
2
  import { Org } from './org';
3
- import { ScratchOrgInfo } from './scratchOrgInfoApi';
3
+ import { ScratchOrgInfo } from './scratchOrgTypes';
4
4
  import { AuthFields, AuthInfo } from './authInfo';
5
5
  export declare const DEFAULT_STREAM_TIMEOUT_MINUTES = 6;
6
6
  export interface ScratchOrgCreateResult {
@@ -13,12 +13,13 @@ const messages_1 = require("../messages");
13
13
  const logger_1 = require("../logger");
14
14
  const configAggregator_1 = require("../config/configAggregator");
15
15
  const sfProject_1 = require("../sfProject");
16
- const sfError_1 = require("../sfError");
16
+ const lifecycleEvents_1 = require("../lifecycleEvents");
17
17
  const org_1 = require("./org");
18
18
  const scratchOrgInfoApi_1 = require("./scratchOrgInfoApi");
19
19
  const scratchOrgSettingsGenerator_1 = require("./scratchOrgSettingsGenerator");
20
20
  const scratchOrgInfoGenerator_1 = require("./scratchOrgInfoGenerator");
21
21
  const connection_1 = require("./connection");
22
+ const scratchOrgLifecycleEvents_1 = require("./scratchOrgLifecycleEvents");
22
23
  messages_1.Messages.importMessagesDirectory(__dirname);
23
24
  const messages = messages_1.Messages.load('@salesforce/core', 'scratchOrgCreate', [
24
25
  'SourceStatusResetFailureError',
@@ -58,6 +59,7 @@ const scratchOrgCreate = async (options) => {
58
59
  var _a;
59
60
  const logger = await logger_1.Logger.child('scratchOrgCreate');
60
61
  logger.debug('scratchOrgCreate');
62
+ await (0, scratchOrgLifecycleEvents_1.emit)({ stage: 'prepare request' });
61
63
  const { hubOrg, connectedAppConsumerKey, durationDays = 1, nonamespace, noancestors, wait = kit_1.Duration.minutes(exports.DEFAULT_STREAM_TIMEOUT_MINUTES), retry = 0, apiversion, definitionjson, definitionfile, orgConfig, clientSecret = undefined, } = options;
62
64
  validateDuration(durationDays);
63
65
  validateRetry(retry);
@@ -100,10 +102,12 @@ const scratchOrgCreate = async (options) => {
100
102
  const username = scratchOrg.getUsername();
101
103
  logger.debug(`scratch org username ${username}`);
102
104
  const configAggregator = new configAggregator_1.ConfigAggregator();
105
+ await (0, scratchOrgLifecycleEvents_1.emit)({ stage: 'deploy settings', scratchOrgInfo: scratchOrgInfoResult });
103
106
  const authInfo = await (0, scratchOrgInfoApi_1.deploySettingsAndResolveUrl)(scratchOrgAuthInfo, (_a = apiversion !== null && apiversion !== void 0 ? apiversion : configAggregator.getPropertyValue('apiVersion')) !== null && _a !== void 0 ? _a : (await scratchOrg.retrieveMaxApiVersion()), settingsGenerator, scratchOrg);
104
107
  logger.trace('Settings deployed to org');
105
108
  /** updating the revision num to zero during org:creation if source members are created during org:create.This only happens for some specific scratch org definition file.*/
106
109
  await updateRevisionCounterToZero(scratchOrg);
110
+ await (0, scratchOrgLifecycleEvents_1.emit)({ stage: 'done', scratchOrgInfo: scratchOrgInfoResult });
107
111
  return {
108
112
  username,
109
113
  scratchOrgInfo: scratchOrgInfoResult,
@@ -126,17 +130,16 @@ const getSignupTargetLoginUrl = async () => {
126
130
  const updateRevisionCounterToZero = async (scratchOrg) => {
127
131
  const conn = scratchOrg.getConnection();
128
132
  const queryResult = await conn.tooling.sobject('SourceMember').find({ RevisionCounter: { $gt: 0 } }, ['Id']);
133
+ if (queryResult.length === 0) {
134
+ return;
135
+ }
129
136
  try {
130
137
  await conn.tooling
131
138
  .sobject('SourceMember')
132
139
  .update(queryResult.map((record) => ({ Id: record.Id, RevisionCounter: 0 })));
133
140
  }
134
141
  catch (err) {
135
- const message = messages.getMessage('SourceStatusResetFailureError', [
136
- scratchOrg.getOrgId(),
137
- scratchOrg.getUsername(),
138
- ]);
139
- throw new sfError_1.SfError(message, 'SourceStatusResetFailure');
142
+ await lifecycleEvents_1.Lifecycle.getInstance().emitWarning(messages.getMessage('SourceStatusResetFailureError', [scratchOrg.getOrgId(), scratchOrg.getUsername()]));
140
143
  }
141
144
  };
142
145
  //# sourceMappingURL=scratchOrgCreate.js.map
@@ -1,4 +1,4 @@
1
1
  import { Optional } from '@salesforce/ts-types';
2
2
  import { Logger } from '../logger';
3
- import { ScratchOrgInfo } from './scratchOrgInfoApi';
3
+ import { ScratchOrgInfo } from './scratchOrgTypes';
4
4
  export declare const checkScratchOrgInfoForErrors: (orgInfo: Optional<ScratchOrgInfo>, hubUsername: Optional<string>, logger: Logger) => ScratchOrgInfo;
@@ -3,45 +3,8 @@ import { Duration } from '@salesforce/kit';
3
3
  import { SaveResult } from 'jsforce';
4
4
  import { AuthInfo } from './authInfo';
5
5
  import { Org } from './org';
6
- import SettingsGenerator, { ObjectSetting } from './scratchOrgSettingsGenerator';
7
- export interface ScratchOrgInfo {
8
- AdminEmail?: string;
9
- readonly CreatedDate?: string;
10
- ConnectedAppCallbackUrl?: string;
11
- ConnectedAppConsumerKey?: string;
12
- Country?: string;
13
- Description?: string;
14
- DurationDays?: string;
15
- Edition?: string;
16
- readonly ErrorCode?: string;
17
- readonly ExpirationDate?: string;
18
- Features?: string;
19
- HasSampleData?: boolean;
20
- readonly Id?: string;
21
- Language?: string;
22
- LoginUrl: string;
23
- readonly Name?: string;
24
- Namespace?: string;
25
- OrgName?: string;
26
- Release?: 'Current' | 'Previous' | 'Preview';
27
- readonly ScratchOrg?: string;
28
- SourceOrg?: string;
29
- readonly AuthCode: string;
30
- Snapshot: string;
31
- readonly Status: 'New' | 'Creating' | 'Active' | 'Error' | 'Deleted';
32
- readonly SignupEmail: string;
33
- readonly SignupUsername: string;
34
- readonly SignupInstance: string;
35
- Username: string;
36
- settings?: Record<string, unknown>;
37
- objectSettings?: {
38
- [objectName: string]: ObjectSetting;
39
- };
40
- orgPreferences?: {
41
- enabled: string[];
42
- disabled: string[];
43
- };
44
- }
6
+ import SettingsGenerator from './scratchOrgSettingsGenerator';
7
+ import { ScratchOrgInfo } from './scratchOrgTypes';
45
8
  export interface JsForceError extends Error {
46
9
  errorCode: string;
47
10
  fields: string[];
@@ -20,6 +20,7 @@ const myDomainResolver_1 = require("../status/myDomainResolver");
20
20
  const authInfo_1 = require("./authInfo");
21
21
  const org_1 = require("./org");
22
22
  const scratchOrgErrorCodes_1 = require("./scratchOrgErrorCodes");
23
+ const scratchOrgLifecycleEvents_1 = require("./scratchOrgLifecycleEvents");
23
24
  messages_1.Messages.importMessagesDirectory(__dirname);
24
25
  const messages = messages_1.Messages.loadMessages('@salesforce/core', 'scratchOrgInfoApi');
25
26
  const errorCodes = messages_1.Messages.load('@salesforce/core', 'scratchOrgErrorCodes', ['C-1007']);
@@ -144,6 +145,7 @@ const getAuthInfo = async (options) => {
144
145
  const authorizeScratchOrg = async (options) => {
145
146
  var _a;
146
147
  const { scratchOrgInfoComplete, hubOrg, clientSecret, signupTargetLoginUrlConfig, retry: maxRetries } = options;
148
+ await (0, scratchOrgLifecycleEvents_1.emit)({ stage: 'authenticate', scratchOrgInfo: scratchOrgInfoComplete });
147
149
  const logger = await logger_1.Logger.child('authorizeScratchOrg');
148
150
  logger.debug(`scratchOrgInfoComplete: ${JSON.stringify(scratchOrgInfoComplete, null, 4)}`);
149
151
  // if we didn't have it marked as a devhub but just successfully used it as one, this will update the authFile, fix cache, etc
@@ -225,6 +227,8 @@ const requestScratchOrgCreation = async (hubOrg, scratchOrgRequest, settings) =>
225
227
  const scratchOrgInfo = (0, mapKeys_1.default)(scratchOrgRequest, kit_1.upperFirst, true);
226
228
  await checkOrgDoesntExist(scratchOrgInfo); // throw if it does exist.
227
229
  try {
230
+ await (0, scratchOrgLifecycleEvents_1.emit)({ stage: 'send request' });
231
+ // return await will cause this catch block to run instead of the caller's catch block
228
232
  return await hubOrg.getConnection().sobject('ScratchOrgInfo').create(scratchOrgInfo);
229
233
  }
230
234
  catch (error) {
@@ -257,11 +261,13 @@ timeout = kit_1.Duration.minutes(15)) => {
257
261
  logger.debug(`polling client result: ${JSON.stringify(resultInProgress, null, 4)}`);
258
262
  // Once it's "done" we can return it
259
263
  if (resultInProgress.Status === 'Active' || resultInProgress.Status === 'Error') {
264
+ await (0, scratchOrgLifecycleEvents_1.emit)({ stage: 'available', scratchOrgInfo: resultInProgress });
260
265
  return {
261
266
  completed: true,
262
267
  payload: resultInProgress,
263
268
  };
264
269
  }
270
+ await (0, scratchOrgLifecycleEvents_1.emit)({ stage: 'wait for org', scratchOrgInfo: resultInProgress });
265
271
  logger.debug(`Scratch org status is ${resultInProgress.Status}`);
266
272
  return {
267
273
  completed: false,
@@ -1,6 +1,6 @@
1
1
  import { SfProjectJson } from '../sfProject';
2
2
  import { Org } from './org';
3
- import { ScratchOrgInfo } from './scratchOrgInfoApi';
3
+ import { ScratchOrgInfo } from './scratchOrgTypes';
4
4
  declare type PartialScratchOrgInfo = Pick<ScratchOrgInfo, 'ConnectedAppConsumerKey' | 'AuthCode' | 'Snapshot' | 'Status' | 'LoginUrl' | 'SignupEmail' | 'SignupUsername' | 'SignupInstance' | 'Username'>;
5
5
  export interface ScratchOrgInfoPayload extends PartialScratchOrgInfo {
6
6
  orgName: string;
@@ -0,0 +1,8 @@
1
+ import { ScratchOrgInfo } from './scratchOrgTypes';
2
+ export declare const scratchOrgLifecycleEventName = "scratchOrgLifecycleEvent";
3
+ export declare const scratchOrgLifecycleStages: readonly ["prepare request", "send request", "wait for org", "available", "authenticate", "deploy settings", "done"];
4
+ export interface ScratchOrgLifecycleEvent {
5
+ stage: typeof scratchOrgLifecycleStages[number];
6
+ scratchOrgInfo?: ScratchOrgInfo;
7
+ }
8
+ export declare const emit: (event: ScratchOrgLifecycleEvent) => Promise<void>;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.emit = exports.scratchOrgLifecycleStages = exports.scratchOrgLifecycleEventName = void 0;
4
+ /*
5
+ * Copyright (c) 2020, salesforce.com, inc.
6
+ * All rights reserved.
7
+ * Licensed under the BSD 3-Clause license.
8
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
9
+ */
10
+ const lifecycleEvents_1 = require("../lifecycleEvents");
11
+ const emitter = lifecycleEvents_1.Lifecycle.getInstance();
12
+ exports.scratchOrgLifecycleEventName = 'scratchOrgLifecycleEvent';
13
+ exports.scratchOrgLifecycleStages = [
14
+ 'prepare request',
15
+ 'send request',
16
+ 'wait for org',
17
+ 'available',
18
+ 'authenticate',
19
+ 'deploy settings',
20
+ 'done',
21
+ ];
22
+ const emit = async (event) => {
23
+ emitter.emit(exports.scratchOrgLifecycleEventName, event);
24
+ };
25
+ exports.emit = emit;
26
+ //# sourceMappingURL=scratchOrgLifecycleEvents.js.map
@@ -1,5 +1,5 @@
1
1
  import { JsonMap } from '@salesforce/ts-types';
2
- import { ScratchOrgInfo } from './scratchOrgInfoApi';
2
+ import { ScratchOrgInfo } from './scratchOrgTypes';
3
3
  import { Org } from './org';
4
4
  export declare enum RequestStatus {
5
5
  Pending = "Pending",
@@ -10,10 +10,6 @@ export declare enum RequestStatus {
10
10
  Canceling = "Canceling",
11
11
  Canceled = "Canceled"
12
12
  }
13
- export interface ObjectSetting extends JsonMap {
14
- sharingModel?: string;
15
- defaultRecordType?: string;
16
- }
17
13
  export interface BusinessProcessFileContent extends JsonMap {
18
14
  fullName: string;
19
15
  isActive: boolean;
@@ -0,0 +1,43 @@
1
+ import { JsonMap } from '@salesforce/ts-types';
2
+ export interface ScratchOrgInfo {
3
+ AdminEmail?: string;
4
+ readonly CreatedDate?: string;
5
+ ConnectedAppCallbackUrl?: string;
6
+ ConnectedAppConsumerKey?: string;
7
+ Country?: string;
8
+ Description?: string;
9
+ DurationDays?: string;
10
+ Edition?: string;
11
+ readonly ErrorCode?: string;
12
+ readonly ExpirationDate?: string;
13
+ Features?: string;
14
+ HasSampleData?: boolean;
15
+ readonly Id?: string;
16
+ Language?: string;
17
+ LoginUrl: string;
18
+ readonly Name?: string;
19
+ Namespace?: string;
20
+ OrgName?: string;
21
+ Release?: 'Current' | 'Previous' | 'Preview';
22
+ readonly ScratchOrg?: string;
23
+ SourceOrg?: string;
24
+ readonly AuthCode: string;
25
+ Snapshot: string;
26
+ readonly Status: 'New' | 'Creating' | 'Active' | 'Error' | 'Deleted';
27
+ readonly SignupEmail: string;
28
+ readonly SignupUsername: string;
29
+ readonly SignupInstance: string;
30
+ Username: string;
31
+ settings?: Record<string, unknown>;
32
+ objectSettings?: {
33
+ [objectName: string]: ObjectSetting;
34
+ };
35
+ orgPreferences?: {
36
+ enabled: string[];
37
+ disabled: string[];
38
+ };
39
+ }
40
+ export interface ObjectSetting extends JsonMap {
41
+ sharingModel?: string;
42
+ defaultRecordType?: string;
43
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2020, salesforce.com, inc.
4
+ * All rights reserved.
5
+ * Licensed under the BSD 3-Clause license.
6
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ //# sourceMappingURL=scratchOrgTypes.js.map
@@ -75,11 +75,11 @@ In sfdx-project.json, indicate only one package directory (path) as the default.
75
75
 
76
76
  The sfdx-project.json file must include one, and only one, default package directory (path). Because your sfdx-project.json file contains only one package directory, it must be the default. Remove the `"default": false` key and try again.
77
77
 
78
- # targetOrg
78
+ # target-org
79
79
 
80
80
  Username or alias of the org that all commands run against by default. (sf only)
81
81
 
82
- # targetDevHub
82
+ # target-dev-hub
83
83
 
84
84
  Username or alias of your default Dev Hub org. (sf only)
85
85
 
@@ -93,28 +93,52 @@ Username or alias of your default Dev Hub org. (sfdx only)
93
93
 
94
94
  # isvDebuggerSid
95
95
 
96
- ISV debugger SID
96
+ ISV debugger SID (sfdx only)
97
97
 
98
98
  # isvDebuggerUrl
99
99
 
100
- ISV debugger URL
100
+ ISV debugger URL (sfdx only)
101
+
102
+ # org-isv-debugger-sid
103
+
104
+ ISV debugger SID.
105
+
106
+ # org-isv-debugger-url
107
+
108
+ ISV debugger URL.
101
109
 
102
110
  # apiVersion
103
111
 
112
+ API version of your project. Default: API version of your Dev Hub org. (sfdx only)
113
+
114
+ # org-api-version
115
+
104
116
  API version of your project. Default: API version of your Dev Hub org.
105
117
 
106
118
  # disableTelemetry
107
119
 
108
- Disables the collection of usage and user environment information, etc. Default: true.
120
+ Disables the collection of usage and user environment information, etc. Default: false. (sfdx only)
121
+
122
+ # disable-telemetry
123
+
124
+ Disables the collection of usage and user environment information, etc. Default: false.
109
125
 
110
126
  # maxQueryLimit
111
127
 
128
+ Maximum number of Salesforce records returned by a CLI command. Default: 10,000. (sfdx only)
129
+
130
+ # org-max-query-limit
131
+
112
132
  Maximum number of Salesforce records returned by a CLI command. Default: 10,000.
113
133
 
114
134
  # restDeploy
115
135
 
116
- Whether deployments use the Metadata REST API (true) or SOAP API (false, default value).
136
+ Whether deployments use the Metadata REST API (true) or SOAP API (false, default value). (sfdx only)
117
137
 
118
138
  # instanceUrl
119
139
 
140
+ URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com. (sfdx only)
141
+
142
+ # org-instance-url
143
+
120
144
  URL of the Salesforce instance hosting your org. Default: https://login.salesforce.com.
@@ -94,6 +94,14 @@ Set to true to send messages resulting from failed Salesforce CLI commands to st
94
94
 
95
95
  Level of messages that the CLI writes to the log file. Valid values are trace, debug, info, warn, error, fatal. Default value is warn.
96
96
 
97
+ # sfdxLogRotationCount
98
+
99
+ The default rotation period for logs. Example '1d' will rotate logs daily (at midnight).
100
+
101
+ # sfdxLogRotationPeriod
102
+
103
+ The number of backup rotated log files to keep. Example: '3' will have the base sf.log file, and the past 3 (period) log files.
104
+
97
105
  # sfdxMaxQueryLimit
98
106
 
99
107
  Maximum number of Salesforce records returned by a CLI command. Default value is 10,000. Overrides the maxQueryLimit configuration value.
@@ -166,7 +174,7 @@ Username or alias of your default Dev Hub org. Overrides the target-dev-hub conf
166
174
 
167
175
  Specifies an access token when using a login command that uses access tokens.
168
176
 
169
- # sfApiVersion
177
+ # sfOrgApiVersion
170
178
 
171
179
  API version for a specific project or all projects. Default value is the API version of your Dev Hub. Overrides the apiVersion configuration variable.
172
180
 
@@ -210,7 +218,7 @@ Time, in seconds, that Salesforce CLI waits for the Lightning Experience custom
210
218
 
211
219
  Set to true to scope Apex test results to the classes entered during a test run when running the Apex test commands.
212
220
 
213
- # sfInstanceUrl
221
+ # sfOrgInstanceUrl
214
222
 
215
223
  URL of the Salesforce instance that is hosting your org. Default value is https://login.salesforce.com. Overrides the instanceUrl configuration variable.
216
224
 
@@ -222,7 +230,15 @@ Set to true to send messages resulting from failed Salesforce CLI commands to st
222
230
 
223
231
  Level of messages that the CLI writes to the log file. Valid values are trace, debug, info, warn, error, fatal. Default value is warn.
224
232
 
225
- # sfMaxQueryLimit
233
+ # sfLogRotationCount
234
+
235
+ The default rotation period for logs. Example '1d' will rotate logs daily (at midnight).
236
+
237
+ # sfLogRotationPeriod
238
+
239
+ The number of backup rotated log files to keep. Example: '3' will have the base sf.log file, and the past 3 (period) log files.
240
+
241
+ # sfOrgMaxQueryLimit
226
242
 
227
243
  Maximum number of Salesforce records returned by a CLI command. Default value is 10,000. Overrides the maxQueryLimit configuration variable.
228
244
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core",
3
- "version": "3.9.0",
3
+ "version": "3.11.0",
4
4
  "description": "Core libraries to interact with SFDX projects, orgs, and APIs.",
5
5
  "main": "lib/exported",
6
6
  "types": "lib/exported.d.ts",