@salesforce/core 3.7.3 → 3.7.4

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.
@@ -9,7 +9,7 @@ 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
11
  const messages_1 = require("../messages");
12
- messages_1.Messages.importMessagesDirectory(path_1.join(__dirname));
12
+ messages_1.Messages.importMessagesDirectory((0, path_1.join)(__dirname));
13
13
  const messages = messages_1.Messages.load('@salesforce/core', 'config', ['targetOrg', 'targetDevHub']);
14
14
  var OrgConfigProperties;
15
15
  (function (OrgConfigProperties) {
@@ -61,7 +61,7 @@ class PermissionSetAssignment {
61
61
  query += ` AND NamespacePrefix='${nsPrefix}'`;
62
62
  }
63
63
  const result = await this.org.getConnection().query(query);
64
- const permissionSetId = ts_types_1.getString(result, 'records[0].Id');
64
+ const permissionSetId = (0, ts_types_1.getString)(result, 'records[0].Id');
65
65
  if (!permissionSetId) {
66
66
  if (nsPrefix) {
67
67
  throw messages.createError('assignCommandPermissionSetNotFoundForNSError', [permSetName, nsPrefix]);
@@ -77,8 +77,8 @@ class PermissionSetAssignment {
77
77
  const createResponse = await this.org
78
78
  .getConnection()
79
79
  .sobject('PermissionSetAssignment')
80
- .create(kit_1.mapKeys(assignment, (value, key) => kit_1.upperFirst(key)));
81
- if (ts_types_1.hasArray(createResponse, 'errors') && createResponse.errors.length > 0) {
80
+ .create((0, kit_1.mapKeys)(assignment, (value, key) => (0, kit_1.upperFirst)(key)));
81
+ if ((0, ts_types_1.hasArray)(createResponse, 'errors') && createResponse.errors.length > 0) {
82
82
  let message = messages.getMessage('errorsEncounteredCreatingAssignment');
83
83
  const errors = createResponse.errors;
84
84
  if (errors && errors.length > 0) {
package/lib/org/user.js CHANGED
@@ -84,18 +84,18 @@ async function retrieveUserFields(logger, username) {
84
84
  const result = await connection.query(requiredFieldsFromAdminQuery);
85
85
  logger.debug('Successfully retrieved the admin user for this org.');
86
86
  if (result.totalSize === 1) {
87
- const results = kit_1.mapKeys(result.records[0], (value, key) => kit_1.lowerFirst(key));
87
+ const results = (0, kit_1.mapKeys)(result.records[0], (value, key) => (0, kit_1.lowerFirst)(key));
88
88
  const fields = {
89
- id: ts_types_1.ensure(ts_types_1.getString(results, exports.REQUIRED_FIELDS.id)),
89
+ id: (0, ts_types_1.ensure)((0, ts_types_1.getString)(results, exports.REQUIRED_FIELDS.id)),
90
90
  username,
91
- alias: ts_types_1.ensure(ts_types_1.getString(results, exports.REQUIRED_FIELDS.alias)),
92
- email: ts_types_1.ensure(ts_types_1.getString(results, exports.REQUIRED_FIELDS.email)),
93
- emailEncodingKey: ts_types_1.ensure(ts_types_1.getString(results, exports.REQUIRED_FIELDS.emailEncodingKey)),
94
- languageLocaleKey: ts_types_1.ensure(ts_types_1.getString(results, exports.REQUIRED_FIELDS.languageLocaleKey)),
95
- localeSidKey: ts_types_1.ensure(ts_types_1.getString(results, exports.REQUIRED_FIELDS.localeSidKey)),
96
- profileId: ts_types_1.ensure(ts_types_1.getString(results, exports.REQUIRED_FIELDS.profileId)),
97
- lastName: ts_types_1.ensure(ts_types_1.getString(results, exports.REQUIRED_FIELDS.lastName)),
98
- timeZoneSidKey: ts_types_1.ensure(ts_types_1.getString(results, exports.REQUIRED_FIELDS.timeZoneSidKey)),
91
+ alias: (0, ts_types_1.ensure)((0, ts_types_1.getString)(results, exports.REQUIRED_FIELDS.alias)),
92
+ email: (0, ts_types_1.ensure)((0, ts_types_1.getString)(results, exports.REQUIRED_FIELDS.email)),
93
+ emailEncodingKey: (0, ts_types_1.ensure)((0, ts_types_1.getString)(results, exports.REQUIRED_FIELDS.emailEncodingKey)),
94
+ languageLocaleKey: (0, ts_types_1.ensure)((0, ts_types_1.getString)(results, exports.REQUIRED_FIELDS.languageLocaleKey)),
95
+ localeSidKey: (0, ts_types_1.ensure)((0, ts_types_1.getString)(results, exports.REQUIRED_FIELDS.localeSidKey)),
96
+ profileId: (0, ts_types_1.ensure)((0, ts_types_1.getString)(results, exports.REQUIRED_FIELDS.profileId)),
97
+ lastName: (0, ts_types_1.ensure)((0, ts_types_1.getString)(results, exports.REQUIRED_FIELDS.lastName)),
98
+ timeZoneSidKey: (0, ts_types_1.ensure)((0, ts_types_1.getString)(results, exports.REQUIRED_FIELDS.timeZoneSidKey)),
99
99
  };
100
100
  return fields;
101
101
  }
@@ -231,7 +231,7 @@ class User extends kit_1.AsyncCreatable {
231
231
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
232
232
  // @ts-ignore TODO: expose `soap` on Connection however appropriate
233
233
  const soap = userConnection.soap;
234
- await soap.setPassword(ts_types_1.ensureString(info.getFields().userId), buffer.toString('utf8'));
234
+ await soap.setPassword((0, ts_types_1.ensureString)(info.getFields().userId), buffer.toString('utf8'));
235
235
  this.logger.debug(`Set password for userId: ${info.getFields().userId}`);
236
236
  resolve();
237
237
  }
@@ -389,17 +389,17 @@ class User extends kit_1.AsyncCreatable {
389
389
  body,
390
390
  };
391
391
  const response = await this.rawRequest(conn, info);
392
- const responseBody = kit_1.parseJsonMap(ts_types_1.ensureString(response['body']));
393
- const statusCode = ts_types_1.asNumber(response.statusCode);
392
+ const responseBody = (0, kit_1.parseJsonMap)((0, ts_types_1.ensureString)(response['body']));
393
+ const statusCode = (0, ts_types_1.asNumber)(response.statusCode);
394
394
  this.logger.debug(`user create response.statusCode: ${response.statusCode}`);
395
395
  if (!(statusCode === 201 || statusCode === 200)) {
396
396
  let message = messages.getMessage('invalidHttpResponseCreatingUser', [statusCode]);
397
397
  if (responseBody) {
398
- const errors = ts_types_1.asJsonArray(responseBody.Errors);
398
+ const errors = (0, ts_types_1.asJsonArray)(responseBody.Errors);
399
399
  if (errors && errors.length > 0) {
400
400
  message = `${message} causes:${os_1.EOL}`;
401
401
  errors.forEach((singleMessage) => {
402
- if (!ts_types_1.isJsonMap(singleMessage))
402
+ if (!(0, ts_types_1.isJsonMap)(singleMessage))
403
403
  return;
404
404
  message = `${message}${os_1.EOL}${singleMessage.description}`;
405
405
  });
@@ -408,11 +408,11 @@ class User extends kit_1.AsyncCreatable {
408
408
  this.logger.debug(message);
409
409
  throw new sfdxError_1.SfdxError(message, 'UserCreateHttpError');
410
410
  }
411
- fields.id = ts_types_1.ensureString(responseBody.id);
411
+ fields.id = (0, ts_types_1.ensureString)(responseBody.id);
412
412
  await this.updateRequiredUserFields(fields);
413
413
  const buffer = new secureBuffer_1.SecureBuffer();
414
- const headers = ts_types_1.ensureJsonMap(response.headers);
415
- const autoApproveUser = ts_types_1.ensureString(headers['auto-approve-user']);
414
+ const headers = (0, ts_types_1.ensureJsonMap)(response.headers);
415
+ const autoApproveUser = (0, ts_types_1.ensureString)(headers['auto-approve-user']);
416
416
  buffer.consume(Buffer.from(autoApproveUser));
417
417
  return {
418
418
  buffer,
@@ -433,13 +433,13 @@ class User extends kit_1.AsyncCreatable {
433
433
  * @param fields The fields for the user.
434
434
  */
435
435
  async updateRequiredUserFields(fields) {
436
- const leftOverRequiredFields = kit_1.omit(fields, [
436
+ const leftOverRequiredFields = (0, kit_1.omit)(fields, [
437
437
  exports.REQUIRED_FIELDS.username,
438
438
  exports.REQUIRED_FIELDS.email,
439
439
  exports.REQUIRED_FIELDS.lastName,
440
440
  exports.REQUIRED_FIELDS.profileId,
441
441
  ]);
442
- const object = kit_1.mapKeys(leftOverRequiredFields, (value, key) => kit_1.upperFirst(key));
442
+ const object = (0, kit_1.mapKeys)(leftOverRequiredFields, (value, key) => (0, kit_1.upperFirst)(key));
443
443
  await this.org.getConnection().sobject('User').update(object);
444
444
  this.logger.debug(`Successfully Updated additional properties for user: ${fields.username}`);
445
445
  }
@@ -90,11 +90,11 @@ class SchemaPrinter {
90
90
  add('');
91
91
  }
92
92
  Object.keys(this.schema.properties).forEach((key) => {
93
- const properties = ts_types_1.asJsonMap(this.schema.properties);
93
+ const properties = (0, ts_types_1.asJsonMap)(this.schema.properties);
94
94
  if (!properties) {
95
95
  return;
96
96
  }
97
- this.parseProperty(key, ts_types_1.asJsonMap(properties[key]), startLevel);
97
+ this.parseProperty(key, (0, ts_types_1.asJsonMap)(properties[key]), startLevel);
98
98
  add('');
99
99
  });
100
100
  }
@@ -144,15 +144,15 @@ class SchemaPrinter {
144
144
  add(` ${property.renderArrayHeader()}`);
145
145
  if (property.items && property.items.type === 'object' && property.items.properties) {
146
146
  Object.keys(property.items.properties).forEach((key) => {
147
- const items = ts_types_1.asJsonMap(property.items);
147
+ const items = (0, ts_types_1.asJsonMap)(property.items);
148
148
  if (!items) {
149
149
  return;
150
150
  }
151
- const properties = ts_types_1.asJsonMap(items.properties);
151
+ const properties = (0, ts_types_1.asJsonMap)(items.properties);
152
152
  if (!properties) {
153
153
  return;
154
154
  }
155
- this.parseProperty(key, ts_types_1.asJsonMap(properties[key]), level + 2);
155
+ this.parseProperty(key, (0, ts_types_1.asJsonMap)(properties[key]), level + 2);
156
156
  });
157
157
  }
158
158
  }
@@ -176,16 +176,16 @@ class SchemaProperty {
176
176
  // if they are defined here, they take precedence over referenced definition properties.
177
177
  this.rawProperty = Object.assign({}, resolveRef(this.schema, this.rawProperty), rawProperty);
178
178
  }
179
- const oneOfs = ts_types_1.asJsonArray(this.rawProperty.oneOf);
179
+ const oneOfs = (0, ts_types_1.asJsonArray)(this.rawProperty.oneOf);
180
180
  if (oneOfs && !this.rawProperty.type) {
181
181
  this.rawProperty.type = oneOfs
182
182
  .map((value) => {
183
- return ts_types_1.isJsonMap(value) ? value.type || value.$ref : value;
183
+ return (0, ts_types_1.isJsonMap)(value) ? value.type || value.$ref : value;
184
184
  })
185
185
  .join('|');
186
186
  }
187
187
  // Handle items references
188
- if (ts_types_1.isJsonMap(this.items) && this.items && this.items.$ref) {
188
+ if ((0, ts_types_1.isJsonMap)(this.items) && this.items && this.items.$ref) {
189
189
  Object.assign(this.items, resolveRef(this.schema, this.items));
190
190
  }
191
191
  }
@@ -213,32 +213,32 @@ class SchemaProperty {
213
213
  return `items(${prop.renderType()}${minItems}) - ${prop.renderTitle()}: ${prop.renderDescription()}`;
214
214
  }
215
215
  get title() {
216
- return ts_types_1.asString(this.rawProperty.title);
216
+ return (0, ts_types_1.asString)(this.rawProperty.title);
217
217
  }
218
218
  get description() {
219
- return ts_types_1.asString(this.rawProperty.description);
219
+ return (0, ts_types_1.asString)(this.rawProperty.description);
220
220
  }
221
221
  get type() {
222
- return ts_types_1.asString(this.rawProperty.type);
222
+ return (0, ts_types_1.asString)(this.rawProperty.type);
223
223
  }
224
224
  get required() {
225
- return ts_types_1.asJsonArray(this.rawProperty.required);
225
+ return (0, ts_types_1.asJsonArray)(this.rawProperty.required);
226
226
  }
227
227
  get properties() {
228
- return ts_types_1.asJsonMap(this.rawProperty.properties);
228
+ return (0, ts_types_1.asJsonMap)(this.rawProperty.properties);
229
229
  }
230
230
  get items() {
231
- return ts_types_1.asJsonMap(this.rawProperty.items);
231
+ return (0, ts_types_1.asJsonMap)(this.rawProperty.items);
232
232
  }
233
233
  get minItems() {
234
- return ts_types_1.asNumber(this.rawProperty.minItems);
234
+ return (0, ts_types_1.asNumber)(this.rawProperty.minItems);
235
235
  }
236
236
  getProperty(key) {
237
237
  const properties = this.getProperties();
238
- return ts_types_1.asJsonMap(properties && properties[key]);
238
+ return (0, ts_types_1.asJsonMap)(properties && properties[key]);
239
239
  }
240
240
  getProperties() {
241
- return ts_types_1.asJsonMap(this.rawProperty.properties);
241
+ return (0, ts_types_1.asJsonMap)(this.rawProperty.properties);
242
242
  }
243
243
  }
244
244
  /**
@@ -254,7 +254,7 @@ function resolveRef(schema, property) {
254
254
  }
255
255
  return ref.split('/').reduce((prev, key) => {
256
256
  const next = prev[key];
257
- return key === '#' ? schema : ts_types_1.isJsonMap(next) ? next : {};
257
+ return key === '#' ? schema : (0, ts_types_1.isJsonMap)(next) ? next : {};
258
258
  }, property);
259
259
  }
260
260
  //# sourceMappingURL=printer.js.map
@@ -101,14 +101,14 @@ class SchemaValidator {
101
101
  */
102
102
  loadExternalSchemas(schema) {
103
103
  const externalSchemas = {};
104
- const schemas = kit_1.getJsonValuesByName(schema, '$ref')
104
+ const schemas = (0, kit_1.getJsonValuesByName)(schema, '$ref')
105
105
  // eslint-disable-next-line no-useless-escape
106
106
  .map((ref) => ref && RegExp(/([\w\.]+)#/).exec(ref))
107
107
  .map((match) => match && match[1])
108
108
  .filter((uri) => !!uri)
109
109
  .map((uri) => this.loadExternalSchema(uri));
110
110
  schemas.forEach((externalSchema) => {
111
- if (ts_types_1.isString(externalSchema.id)) {
111
+ if ((0, ts_types_1.isString)(externalSchema.id)) {
112
112
  externalSchemas[externalSchema.id] = externalSchema;
113
113
  }
114
114
  else {
@@ -147,25 +147,25 @@ class SchemaValidator {
147
147
  const property = RegExp(/^([a-zA-Z0-9\.]+)\.([a-zA-Z0-9]+)$/).exec(error.path);
148
148
  const getPropValue = (prop) => {
149
149
  const reducer = (obj, name) => {
150
- if (!ts_types_1.isJsonMap(obj))
150
+ if (!(0, ts_types_1.isJsonMap)(obj))
151
151
  return;
152
- if (ts_types_1.isJsonMap(obj.properties))
152
+ if ((0, ts_types_1.isJsonMap)(obj.properties))
153
153
  return obj.properties[name];
154
154
  if (name === '0')
155
- return ts_types_1.asJsonArray(obj.items);
155
+ return (0, ts_types_1.asJsonArray)(obj.items);
156
156
  return obj[name] || obj[prop];
157
157
  };
158
158
  return error.path.split('.').reduce(reducer, schema);
159
159
  };
160
160
  const getEnumValues = () => {
161
- const enumSchema = ts_types_1.asJsonMap(getPropValue('enum'));
162
- return (enumSchema && ts_types_1.getJsonArray(enumSchema, 'enum', []).join(', ')) || '';
161
+ const enumSchema = (0, ts_types_1.asJsonMap)(getPropValue('enum'));
162
+ return (enumSchema && (0, ts_types_1.getJsonArray)(enumSchema, 'enum', []).join(', ')) || '';
163
163
  };
164
164
  switch (error.keyword) {
165
165
  case 'additionalProperties':
166
166
  // Missing Typing
167
167
  // eslint-disable-next-line no-case-declarations
168
- const additionalProperties = ts_types_1.get(error, 'additionalProperties');
168
+ const additionalProperties = (0, ts_types_1.get)(error, 'additionalProperties');
169
169
  return `${error.path} should NOT have additional properties '${additionalProperties}'`;
170
170
  case 'required':
171
171
  if (property) {
package/lib/sfdxError.js CHANGED
@@ -52,7 +52,7 @@ class SfdxError extends kit_1.NamedError {
52
52
  * @param err The error to convert.
53
53
  */
54
54
  static wrap(err) {
55
- if (ts_types_1.isString(err)) {
55
+ if ((0, ts_types_1.isString)(err)) {
56
56
  return new SfdxError(err);
57
57
  }
58
58
  if (err instanceof SfdxError) {
@@ -60,7 +60,7 @@ class SfdxError extends kit_1.NamedError {
60
60
  }
61
61
  const sfdxError = new SfdxError(err.message, err.name, undefined, err);
62
62
  // If the original error has a code, use that instead of name.
63
- if (ts_types_1.hasString(err, 'code')) {
63
+ if ((0, ts_types_1.hasString)(err, 'code')) {
64
64
  sfdxError.code = err.code;
65
65
  }
66
66
  return sfdxError;
@@ -110,12 +110,13 @@ class SfdxProjectJson extends configFile_1.ConfigFile {
110
110
  await validator.validate(this.getContents());
111
111
  }
112
112
  catch (err) {
113
+ const error = err;
113
114
  // Don't throw errors if the global isn't valid, but still warn the user.
114
115
  if (kit_1.env.getBoolean('SFDX_PROJECT_JSON_VALIDATION', false) && !this.options.isGlobal) {
115
- throw messages.createError('schemaValidationError', [this.getPath(), err.message], [this.getPath()], err);
116
+ throw messages.createError('schemaValidationError', [this.getPath(), error.message], [this.getPath()], error);
116
117
  }
117
118
  else {
118
- this.logger.warn(messages.getMessage('schemaValidationError', [this.getPath(), err.message]));
119
+ this.logger.warn(messages.getMessage('schemaValidationError', [this.getPath(), error.message]));
119
120
  }
120
121
  }
121
122
  }
@@ -149,12 +150,13 @@ class SfdxProjectJson extends configFile_1.ConfigFile {
149
150
  validator.validateSync(this.getContents());
150
151
  }
151
152
  catch (err) {
153
+ const error = err;
152
154
  // Don't throw errors if the global isn't valid, but still warn the user.
153
155
  if (kit_1.env.getBoolean('SFDX_PROJECT_JSON_VALIDATION', false) && !this.options.isGlobal) {
154
- throw messages.createError('schemaValidationError', [this.getPath(), err.message], [this.getPath()], err);
156
+ throw messages.createError('schemaValidationError', [this.getPath(), error.message], [this.getPath()], error);
155
157
  }
156
158
  else {
157
- this.logger.warn(messages.getMessage('schemaValidationError', [this.getPath(), err.message]));
159
+ this.logger.warn(messages.getMessage('schemaValidationError', [this.getPath(), error.message]));
158
160
  }
159
161
  }
160
162
  }
@@ -169,16 +171,16 @@ class SfdxProjectJson extends configFile_1.ConfigFile {
169
171
  // This has to be done on the fly so it won't be written back to the file
170
172
  // This is a fast operation so no need to cache it so it stays immutable.
171
173
  const packageDirs = (contents.packageDirectories || []).map((packageDir) => {
172
- if (path_1.isAbsolute(packageDir.path)) {
174
+ if ((0, path_1.isAbsolute)(packageDir.path)) {
173
175
  throw messages.createError('invalidPackageDirectory', [packageDir.path]);
174
176
  }
175
177
  const regex = path_1.sep === '/' ? /\\/g : /\//g;
176
178
  // Change packageDir paths to have path separators that match the OS
177
179
  const path = packageDir.path.replace(regex, path_1.sep);
178
180
  // Normalize and remove any ending path separators
179
- const name = path_1.normalize(path).replace(new RegExp(`\\${path_1.sep}$`), '');
181
+ const name = (0, path_1.normalize)(path).replace(new RegExp(`\\${path_1.sep}$`), '');
180
182
  // Always end in a path sep for standardization on folder paths
181
- const fullPath = `${path_1.dirname(this.getPath())}${path_1.sep}${name}${path_1.sep}`;
183
+ const fullPath = `${(0, path_1.dirname)(this.getPath())}${path_1.sep}${name}${path_1.sep}`;
182
184
  if (!this.doesPackageExist(fullPath)) {
183
185
  throw messages.createError('missingPackageDirectory', [packageDir.path]);
184
186
  }
@@ -290,7 +292,7 @@ class SfdxProject {
290
292
  const project = new SfdxProject(path);
291
293
  SfdxProject.instances.set(path, project);
292
294
  }
293
- return ts_types_1.ensure(SfdxProject.instances.get(path));
295
+ return (0, ts_types_1.ensure)(SfdxProject.instances.get(path));
294
296
  }
295
297
  /**
296
298
  * Get a Project from a given path or from the working directory.
@@ -306,7 +308,7 @@ class SfdxProject {
306
308
  const project = new SfdxProject(path);
307
309
  SfdxProject.instances.set(path, project);
308
310
  }
309
- return ts_types_1.ensure(SfdxProject.instances.get(path));
311
+ return (0, ts_types_1.ensure)(SfdxProject.instances.get(path));
310
312
  }
311
313
  /**
312
314
  * Performs an upward directory search for an sfdx project file. Returns the absolute path to the project.
@@ -320,7 +322,7 @@ class SfdxProject {
320
322
  * **See** [process.cwd()](https://nodejs.org/api/process.html#process_process_cwd)
321
323
  */
322
324
  static async resolveProjectPath(dir) {
323
- return internal_1.resolveProjectPath(dir);
325
+ return (0, internal_1.resolveProjectPath)(dir);
324
326
  }
325
327
  /**
326
328
  * Performs a synchronous upward directory search for an sfdx project file. Returns the absolute path to the project.
@@ -334,7 +336,7 @@ class SfdxProject {
334
336
  * **See** [process.cwd()](https://nodejs.org/api/process.html#process_process_cwd)
335
337
  */
336
338
  static resolveProjectPathSync(dir) {
337
- return internal_1.resolveProjectPathSync(dir);
339
+ return (0, internal_1.resolveProjectPathSync)(dir);
338
340
  }
339
341
  /**
340
342
  * Returns the project path.
@@ -434,7 +436,7 @@ class SfdxProject {
434
436
  */
435
437
  getPackageFromPath(path) {
436
438
  const packageDirs = this.getPackageDirectories();
437
- const match = packageDirs.find((packageDir) => path_1.basename(path) === packageDir.name || path.includes(packageDir.fullPath));
439
+ const match = packageDirs.find((packageDir) => (0, path_1.basename)(path) === packageDir.name || path.includes(packageDir.fullPath));
438
440
  return match;
439
441
  }
440
442
  /**
@@ -530,7 +532,7 @@ class SfdxProject {
530
532
  configAggregator_1.ConfigAggregator.create(),
531
533
  ]);
532
534
  await Promise.all([global.read(), local.read()]);
533
- this.projectConfig = kit_1.defaults(local.toObject(), global.toObject());
535
+ this.projectConfig = (0, kit_1.defaults)(local.toObject(), global.toObject());
534
536
  // Add fields in sfdx-config.json
535
537
  Object.assign(this.projectConfig, configAggregator.getConfig());
536
538
  // we don't have a login url yet, so use instanceUrl from config or default
@@ -79,7 +79,7 @@ class MyDomainResolver extends kit_1.AsyncOptionalCreatable {
79
79
  payload: '127.0.0.1',
80
80
  };
81
81
  }
82
- dnsResult = await util_1.promisify(dns_1.lookup)(host);
82
+ dnsResult = await (0, util_1.promisify)(dns_1.lookup)(host);
83
83
  self.logger.debug(`Successfully resolved host: ${host} result: ${JSON.stringify(dnsResult)}`);
84
84
  return {
85
85
  completed: true,
@@ -100,12 +100,12 @@ class MyDomainResolver extends kit_1.AsyncOptionalCreatable {
100
100
  timeoutErrorName: 'MyDomainResolverTimeoutError',
101
101
  };
102
102
  const client = await pollingClient_1.PollingClient.create(pollingOptions);
103
- return ts_types_1.ensureString(await client.subscribe());
103
+ return (0, ts_types_1.ensureString)(await client.subscribe());
104
104
  }
105
105
  async getCnames() {
106
106
  try {
107
107
  await this.resolve();
108
- return await util_1.promisify(dns_1.resolveCname)(this.options.url.host);
108
+ return await (0, util_1.promisify)(dns_1.resolveCname)(this.options.url.host);
109
109
  }
110
110
  catch (e) {
111
111
  this.logger.debug(`An error occurred trying to resolve: ${this.options.url.host}`);
@@ -39,7 +39,7 @@ class PollingClient extends kit_1.AsyncOptionalCreatable {
39
39
  */
40
40
  constructor(options) {
41
41
  super(options);
42
- this.options = ts_types_1.ensure(options);
42
+ this.options = (0, ts_types_1.ensure)(options);
43
43
  }
44
44
  /**
45
45
  * Asynchronous initializer.
@@ -69,7 +69,7 @@ class PollingClient extends kit_1.AsyncOptionalCreatable {
69
69
  }
70
70
  throw new Error('Operation did not complete. Retrying...'); // triggers a retry
71
71
  };
72
- const finalResult = ts_retry_promise_1.retryDecorator(doPoll, {
72
+ const finalResult = (0, ts_retry_promise_1.retryDecorator)(doPoll, {
73
73
  timeout: this.options.timeout.milliseconds,
74
74
  delay: this.options.frequency.milliseconds,
75
75
  retries: 'INFINITELY',
@@ -108,8 +108,8 @@ class StreamingClient extends lib_1.AsyncOptionalCreatable {
108
108
  */
109
109
  constructor(options) {
110
110
  super(options);
111
- this.options = lib_2.ensure(options);
112
- const instanceUrl = lib_2.ensure(this.options.org.getConnection().getAuthInfoFields().instanceUrl);
111
+ this.options = (0, lib_2.ensure)(options);
112
+ const instanceUrl = (0, lib_2.ensure)(this.options.org.getConnection().getAuthInfoFields().instanceUrl);
113
113
  /**
114
114
  * The salesforce network infrastructure issues a cookie called sfdx-stream if it sees /cometd in the url.
115
115
  * Without this cookie request response streams will experience intermittent client session failures.
@@ -126,7 +126,7 @@ class StreamingClient extends lib_1.AsyncOptionalCreatable {
126
126
  * Enable SFDX_ENABLE_FAYE_REQUEST_RESPONSE_LOGGING to debug potential session problems and to verify cookie
127
127
  * exchanges.
128
128
  */
129
- this.targetUrl = url_1.resolve(instanceUrl, `cometd/${this.options.apiVersion}`);
129
+ this.targetUrl = (0, url_1.resolve)(instanceUrl, `cometd/${this.options.apiVersion}`);
130
130
  this.cometClient = this.options.streamingImpl.getCometClient(this.targetUrl);
131
131
  this.options.streamingImpl.setLogger(this.log.bind(this));
132
132
  this.cometClient.on('transport:up', () => this.log('Transport up event received'));
@@ -172,7 +172,7 @@ class StreamingClient extends lib_1.AsyncOptionalCreatable {
172
172
  const replayFromMap = {};
173
173
  replayFromMap[this.options.channel] = replayId;
174
174
  // add "ext : { "replay" : { CHANNEL : REPLAY_VALUE }}" to subscribe message
175
- lib_1.set(message, 'ext.replay', replayFromMap);
175
+ (0, lib_1.set)(message, 'ext.replay', replayFromMap);
176
176
  }
177
177
  callback(message);
178
178
  },
@@ -273,7 +273,7 @@ class StreamingClient extends lib_1.AsyncOptionalCreatable {
273
273
  if (message &&
274
274
  message.channel === '/meta/handshake' &&
275
275
  message.error &&
276
- lib_2.ensureString(message.error).includes('400::API version in the URI is mandatory')) {
276
+ (0, lib_2.ensureString)(message.error).includes('400::API version in the URI is mandatory')) {
277
277
  throw messages.createError('handshakeApiVersionError', [this.options.apiVersion]);
278
278
  }
279
279
  cb(message);
@@ -372,7 +372,7 @@ exports.StreamingClient = StreamingClient;
372
372
  Faye.logger = {};
373
373
  ['info', 'error', 'fatal', 'warn', 'debug'].forEach((element) => {
374
374
  // @ts-ignore
375
- lib_1.set(Faye.logger, element, logLine);
375
+ (0, lib_1.set)(Faye.logger, element, logLine);
376
376
  });
377
377
  },
378
378
  };
package/lib/testSetup.js CHANGED
@@ -27,13 +27,13 @@ const streamingClient_1 = require("./status/streamingClient");
27
27
  const globalInfo_1 = require("./globalInfo");
28
28
  const global_1 = require("./global");
29
29
  const uniqid = () => {
30
- return crypto_1.randomBytes(16).toString('hex');
30
+ return (0, crypto_1.randomBytes)(16).toString('hex');
31
31
  };
32
32
  function getTestLocalPath(uid) {
33
- return path_1.join(os_1.tmpdir(), uid, 'sfdx_core', 'local');
33
+ return (0, path_1.join)((0, os_1.tmpdir)(), uid, 'sfdx_core', 'local');
34
34
  }
35
35
  function getTestGlobalPath(uid) {
36
- return path_1.join(os_1.tmpdir(), uid, 'sfdx_core', 'global');
36
+ return (0, path_1.join)((0, os_1.tmpdir)(), uid, 'sfdx_core', 'global');
37
37
  }
38
38
  function retrieveRootPathSync(isGlobal, uid = uniqid()) {
39
39
  return isGlobal ? getTestGlobalPath(uid) : getTestLocalPath(uid);
@@ -43,7 +43,7 @@ async function retrieveRootPath(isGlobal, uid = uniqid()) {
43
43
  return retrieveRootPathSync(isGlobal, uid);
44
44
  }
45
45
  function defaultFakeConnectionRequest() {
46
- return Promise.resolve(ts_types_1.ensureAnyJson({ records: [] }));
46
+ return Promise.resolve((0, ts_types_1.ensureAnyJson)({ records: [] }));
47
47
  }
48
48
  /**
49
49
  * Instantiate a @salesforce/core test context. This is automatically created by `const $$ = testSetup()`
@@ -78,7 +78,7 @@ const instantiateContext = (sinon) => {
78
78
  }
79
79
  // Import all the messages files in the sfdx-core messages dir.
80
80
  // Messages.importMessagesDirectory(pathJoin(__dirname, '..', '..'));
81
- messages_1.Messages.importMessagesDirectory(path_1.join(__dirname));
81
+ messages_1.Messages.importMessagesDirectory((0, path_1.join)(__dirname));
82
82
  // Create a global sinon sandbox and a test logger instance for use within tests.
83
83
  const defaultSandbox = sinon.createSandbox();
84
84
  const testContext = {
@@ -110,7 +110,7 @@ const instantiateContext = (sinon) => {
110
110
  const stub = this.configStubs[name];
111
111
  if (stub && stub.contents) {
112
112
  if (group && stub.contents[group]) {
113
- return ts_types_1.ensureJsonMap(stub.contents[group]);
113
+ return (0, ts_types_1.ensureJsonMap)(stub.contents[group]);
114
114
  }
115
115
  else {
116
116
  return stub.contents;
@@ -119,7 +119,7 @@ const instantiateContext = (sinon) => {
119
119
  return {};
120
120
  },
121
121
  setConfigStubContents(name, value) {
122
- if (ts_types_1.ensureString(name) && ts_types_1.isJsonMap(value)) {
122
+ if ((0, ts_types_1.ensureString)(name) && (0, ts_types_1.isJsonMap)(value)) {
123
123
  this.configStubs[name] = value;
124
124
  }
125
125
  },
@@ -169,12 +169,12 @@ const stubContext = (testContext) => {
169
169
  // @ts-ignore
170
170
  global_1.Global.SFDX_INTEROPERABILITY = false;
171
171
  // Most core files create a child logger so stub this to return our test logger.
172
- ts_sinon_1.stubMethod(testContext.SANDBOX, logger_1.Logger, 'child').returns(Promise.resolve(testContext.TEST_LOGGER));
173
- ts_sinon_1.stubMethod(testContext.SANDBOX, logger_1.Logger, 'childFromRoot').returns(testContext.TEST_LOGGER);
172
+ (0, ts_sinon_1.stubMethod)(testContext.SANDBOX, logger_1.Logger, 'child').returns(Promise.resolve(testContext.TEST_LOGGER));
173
+ (0, ts_sinon_1.stubMethod)(testContext.SANDBOX, logger_1.Logger, 'childFromRoot').returns(testContext.TEST_LOGGER);
174
174
  testContext.inProject(true);
175
175
  testContext.SANDBOXES.CONFIG.stub(configFile_1.ConfigFile, 'resolveRootFolder').callsFake((isGlobal) => testContext.rootPathRetriever(isGlobal, testContext.id));
176
176
  testContext.SANDBOXES.CONFIG.stub(configFile_1.ConfigFile, 'resolveRootFolderSync').callsFake((isGlobal) => testContext.rootPathRetrieverSync(isGlobal, testContext.id));
177
- ts_sinon_1.stubMethod(testContext.SANDBOXES.PROJECT, sfdxProject_1.SfdxProjectJson.prototype, 'doesPackageExist').callsFake(() => true);
177
+ (0, ts_sinon_1.stubMethod)(testContext.SANDBOXES.PROJECT, sfdxProject_1.SfdxProjectJson.prototype, 'doesPackageExist').callsFake(() => true);
178
178
  const initStubForRead = (configFile) => {
179
179
  const stub = testContext.configStubs[configFile.constructor.name] || {};
180
180
  // init calls read calls getPath which sets the path on the config file the first time.
@@ -232,14 +232,14 @@ const stubContext = (testContext) => {
232
232
  writeSync.call(this);
233
233
  }
234
234
  };
235
- ts_sinon_1.stubMethod(testContext.SANDBOXES.CONFIG, configFile_1.ConfigFile.prototype, 'writeSync').callsFake(writeSync);
236
- ts_sinon_1.stubMethod(testContext.SANDBOXES.CONFIG, configFile_1.ConfigFile.prototype, 'write').callsFake(write);
237
- ts_sinon_1.stubMethod(testContext.SANDBOXES.CRYPTO, crypto_2.Crypto.prototype, 'getKeyChain').callsFake(() => Promise.resolve({
235
+ (0, ts_sinon_1.stubMethod)(testContext.SANDBOXES.CONFIG, configFile_1.ConfigFile.prototype, 'writeSync').callsFake(writeSync);
236
+ (0, ts_sinon_1.stubMethod)(testContext.SANDBOXES.CONFIG, configFile_1.ConfigFile.prototype, 'write').callsFake(write);
237
+ (0, ts_sinon_1.stubMethod)(testContext.SANDBOXES.CRYPTO, crypto_2.Crypto.prototype, 'getKeyChain').callsFake(() => Promise.resolve({
238
238
  setPassword: () => Promise.resolve(),
239
239
  getPassword: (data, cb) => cb(undefined, '12345678901234567890123456789012'),
240
240
  }));
241
- ts_sinon_1.stubMethod(testContext.SANDBOXES.CONNECTION, connection_1.Connection.prototype, 'isResolvable').resolves(true);
242
- ts_sinon_1.stubMethod(testContext.SANDBOXES.CONNECTION, connection_1.Connection.prototype, 'request').callsFake(function (request, options) {
241
+ (0, ts_sinon_1.stubMethod)(testContext.SANDBOXES.CONNECTION, connection_1.Connection.prototype, 'isResolvable').resolves(true);
242
+ (0, ts_sinon_1.stubMethod)(testContext.SANDBOXES.CONNECTION, connection_1.Connection.prototype, 'request').callsFake(function (request, options) {
243
243
  if (request === `${this.instanceUrl}/services/data`) {
244
244
  return Promise.resolve([{ version: '42.0' }]);
245
245
  }
@@ -278,15 +278,15 @@ const restoreContext = (testContext) => {
278
278
  exports.restoreContext = restoreContext;
279
279
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
280
280
  const _testSetup = (sinon) => {
281
- const testContext = exports.instantiateContext(sinon);
281
+ const testContext = (0, exports.instantiateContext)(sinon);
282
282
  beforeEach(() => {
283
283
  // Allow each test to have their own config aggregator
284
284
  // @ts-ignore clear for testing.
285
285
  delete configAggregator_1.ConfigAggregator.instance;
286
- exports.stubContext(testContext);
286
+ (0, exports.stubContext)(testContext);
287
287
  });
288
288
  afterEach(() => {
289
- exports.restoreContext(testContext);
289
+ (0, exports.restoreContext)(testContext);
290
290
  });
291
291
  return testContext;
292
292
  };
@@ -318,7 +318,7 @@ const _testSetup = (sinon) => {
318
318
  * });
319
319
  * ```
320
320
  */
321
- exports.testSetup = kit_1.once(_testSetup);
321
+ exports.testSetup = (0, kit_1.once)(_testSetup);
322
322
  /**
323
323
  * A pre-canned error for try/catch testing.
324
324
  *
@@ -493,7 +493,7 @@ class MockTestOrgData {
493
493
  this.devHubUsername = username;
494
494
  }
495
495
  makeDevHub() {
496
- kit_1.set(this, 'isDevHub', true);
496
+ (0, kit_1.set)(this, 'isDevHub', true);
497
497
  }
498
498
  createUser(user) {
499
499
  const userMock = new MockTestOrgData();
@@ -544,7 +544,7 @@ class MockTestOrgData {
544
544
  if (this.devHubUsername) {
545
545
  config.devHubUsername = this.devHubUsername;
546
546
  }
547
- const isDevHub = ts_types_1.getBoolean(this, 'isDevHub');
547
+ const isDevHub = (0, ts_types_1.getBoolean)(this, 'isDevHub');
548
548
  if (isDevHub) {
549
549
  config.isDevHub = isDevHub;
550
550
  }
package/lib/util/cache.js CHANGED
@@ -41,12 +41,12 @@ class Cache extends Map {
41
41
  }
42
42
  }
43
43
  static get(key) {
44
- var _b, _c;
44
+ var _b, _c, _d;
45
45
  if (!__classPrivateFieldGet(Cache, _a, "f", _Cache_enabled)) {
46
46
  return undefined;
47
47
  }
48
- __classPrivateFieldSet(_b = Cache.instance(), _Cache_lookups, +__classPrivateFieldGet(_b, _Cache_lookups, "f") + 1, "f");
49
- __classPrivateFieldSet(_c = Cache.instance(), _Cache_hits, __classPrivateFieldGet(_c, _Cache_hits, "f") + (Cache.instance().has(key) ? 1 : 0), "f");
48
+ __classPrivateFieldSet(_b = Cache.instance(), _Cache_lookups, (_c = __classPrivateFieldGet(_b, _Cache_lookups, "f"), _c++, _c), "f");
49
+ __classPrivateFieldSet(_d = Cache.instance(), _Cache_hits, __classPrivateFieldGet(_d, _Cache_hits, "f") + (Cache.instance().has(key) ? 1 : 0), "f");
50
50
  return __classPrivateFieldGet(Cache, _a, "f", _Cache_instance).get(key);
51
51
  }
52
52
  static disable() {