@salesforce/core 4.3.11 → 5.0.1-v5-beta.1

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.
Files changed (51) hide show
  1. package/lib/config/config.js +1 -1
  2. package/lib/config/configFile.d.ts +1 -1
  3. package/lib/config/configFile.js +1 -1
  4. package/lib/crypto/crypto.js +1 -1
  5. package/lib/crypto/keyChain.js +1 -1
  6. package/lib/deviceOauthService.js +1 -1
  7. package/lib/exported.d.ts +1 -1
  8. package/lib/exported.js +1 -1
  9. package/lib/global.d.ts +0 -4
  10. package/lib/global.js +0 -6
  11. package/lib/lifecycleEvents.d.ts +1 -1
  12. package/lib/lifecycleEvents.js +9 -4
  13. package/lib/logger/cleanup.d.ts +11 -0
  14. package/lib/logger/cleanup.js +57 -0
  15. package/lib/logger/filters.d.ts +7 -0
  16. package/lib/logger/filters.js +69 -0
  17. package/lib/{logger.d.ts → logger/logger.d.ts} +34 -155
  18. package/lib/logger/logger.js +399 -0
  19. package/lib/logger/memoryLogger.d.ts +10 -0
  20. package/lib/logger/memoryLogger.js +30 -0
  21. package/lib/logger/transformStream.d.ts +3 -0
  22. package/lib/logger/transformStream.js +57 -0
  23. package/lib/org/authInfo.js +1 -1
  24. package/lib/org/authRemover.js +1 -1
  25. package/lib/org/connection.js +2 -2
  26. package/lib/org/org.js +27 -22
  27. package/lib/org/permissionSetAssignment.js +1 -1
  28. package/lib/org/scratchOrgCreate.js +1 -1
  29. package/lib/org/scratchOrgErrorCodes.js +1 -1
  30. package/lib/org/scratchOrgInfoApi.js +1 -1
  31. package/lib/org/scratchOrgLifecycleEvents.js +2 -3
  32. package/lib/org/scratchOrgSettingsGenerator.js +1 -1
  33. package/lib/org/user.js +1 -1
  34. package/lib/schema/printer.d.ts +1 -1
  35. package/lib/schema/validator.d.ts +1 -1
  36. package/lib/stateAggregator/accessors/orgAccessor.js +1 -1
  37. package/lib/status/myDomainResolver.js +1 -1
  38. package/lib/status/pollingClient.d.ts +1 -1
  39. package/lib/status/pollingClient.js +1 -1
  40. package/lib/status/streamingClient.js +1 -1
  41. package/lib/testSetup.d.ts +1 -1
  42. package/lib/testSetup.js +2 -2
  43. package/lib/util/sfdc.d.ts +2 -0
  44. package/lib/util/sfdc.js +4 -2
  45. package/lib/util/sfdcUrl.js +1 -1
  46. package/lib/util/unwrapArray.d.ts +1 -0
  47. package/lib/util/unwrapArray.js +17 -0
  48. package/lib/util/zipWriter.js +1 -1
  49. package/lib/webOAuthServer.js +1 -1
  50. package/package.json +5 -5
  51. package/lib/logger.js +0 -737
package/lib/org/org.js CHANGED
@@ -17,7 +17,7 @@ const configAggregator_1 = require("../config/configAggregator");
17
17
  const orgUsersConfig_1 = require("../config/orgUsersConfig");
18
18
  const global_1 = require("../global");
19
19
  const lifecycleEvents_1 = require("../lifecycleEvents");
20
- const logger_1 = require("../logger");
20
+ const logger_1 = require("../logger/logger");
21
21
  const sfError_1 = require("../sfError");
22
22
  const sfdc_1 = require("../util/sfdc");
23
23
  const webOAuthServer_1 = require("../webOAuthServer");
@@ -94,14 +94,14 @@ class Org extends kit_1.AsyncOptionalCreatable {
94
94
  async: false,
95
95
  interval: kit_1.Duration.seconds(30),
96
96
  }) {
97
- this.logger.debug(`CreateSandbox called with SandboxRequest: ${JSON.stringify(sandboxReq, undefined, 2)}`);
97
+ this.logger.debug(sandboxReq, 'CreateSandbox called with SandboxRequest');
98
98
  const createResult = await this.connection.tooling.create('SandboxInfo', sandboxReq);
99
- this.logger.debug(`Return from calling tooling.create: ${JSON.stringify(createResult, undefined, 2)}`);
99
+ this.logger.debug(createResult, 'Return from calling tooling.create');
100
100
  if (Array.isArray(createResult) || !createResult.success) {
101
101
  throw messages.createError('sandboxInfoCreateFailed', [JSON.stringify(createResult)]);
102
102
  }
103
103
  const sandboxCreationProgress = await this.querySandboxProcessBySandboxInfoId(createResult.id);
104
- this.logger.debug(`Return from calling singleRecordQuery with tooling: ${JSON.stringify(sandboxCreationProgress, undefined, 2)}`);
104
+ this.logger.debug(sandboxCreationProgress, 'Return from calling singleRecordQuery with tooling');
105
105
  const isAsync = !!options.async;
106
106
  if (isAsync) {
107
107
  // The user didn't want us to poll, so simply return the status
@@ -109,7 +109,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
109
109
  return sandboxCreationProgress;
110
110
  }
111
111
  const [wait, pollInterval] = this.validateWaitOptions(options);
112
- this.logger.debug(`create - pollStatusAndAuth sandboxProcessObj ${JSON.stringify(sandboxCreationProgress, undefined, 2)}, max wait time of ${wait.minutes} minutes`);
112
+ this.logger.debug(sandboxCreationProgress, `create - pollStatusAndAuth sandboxProcessObj, max wait time of ${wait.minutes} minutes`);
113
113
  return this.pollStatusAndAuth({
114
114
  sandboxProcessObj: sandboxCreationProgress,
115
115
  wait,
@@ -125,7 +125,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
125
125
  */
126
126
  async cloneSandbox(sandboxReq, sourceSandboxName, options) {
127
127
  sandboxReq.SourceId = (await this.querySandboxProcessBySandboxName(sourceSandboxName)).SandboxInfoId;
128
- this.logger.debug('Clone sandbox sourceId %s', sandboxReq.SourceId);
128
+ this.logger.debug(`Clone sandbox sourceId ${sandboxReq.SourceId}`);
129
129
  return this.createSandbox(sandboxReq, options);
130
130
  }
131
131
  /**
@@ -141,7 +141,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
141
141
  async: false,
142
142
  interval: kit_1.Duration.seconds(30),
143
143
  }) {
144
- this.logger.debug(`ResumeSandbox called with ResumeSandboxRequest: ${JSON.stringify(resumeSandboxRequest, undefined, 2)}`);
144
+ this.logger.debug(resumeSandboxRequest, 'ResumeSandbox called with ResumeSandboxRequest');
145
145
  let sandboxCreationProgress;
146
146
  // seed the sandboxCreationProgress via the resumeSandboxRequest options
147
147
  if (resumeSandboxRequest.SandboxName) {
@@ -155,7 +155,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
155
155
  resumeSandboxRequest.SandboxName ?? resumeSandboxRequest.SandboxProcessObjId,
156
156
  ]);
157
157
  }
158
- this.logger.debug(`Return from calling singleRecordQuery with tooling: ${JSON.stringify(sandboxCreationProgress, undefined, 2)}`);
158
+ this.logger.debug(sandboxCreationProgress, 'Return from calling singleRecordQuery with tooling');
159
159
  if (!sandboxIsResumable(sandboxCreationProgress.Status)) {
160
160
  throw messages.createError('sandboxNotResumable', [
161
161
  sandboxCreationProgress.SandboxName,
@@ -172,7 +172,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
172
172
  if (sandboxInfo) {
173
173
  await lifecycleEvents_1.Lifecycle.getInstance().emit(SandboxEvents.EVENT_AUTH, sandboxInfo);
174
174
  try {
175
- this.logger.debug(`sandbox signup complete with ${JSON.stringify(sandboxInfo, undefined, 2)}`);
175
+ this.logger.debug(sandboxInfo, 'sandbox signup complete');
176
176
  await this.writeSandboxAuthFile(sandboxCreationProgress, sandboxInfo);
177
177
  return sandboxCreationProgress;
178
178
  }
@@ -184,7 +184,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
184
184
  await lifecycleEvents_1.Lifecycle.getInstance().emit(SandboxEvents.EVENT_ASYNC_RESULT, sandboxCreationProgress);
185
185
  throw messages.createError('sandboxCreateNotComplete');
186
186
  }
187
- this.logger.debug(`resume - pollStatusAndAuth sandboxProcessObj ${JSON.stringify(sandboxCreationProgress, undefined, 2)}, max wait time of ${wait.minutes} minutes`);
187
+ this.logger.debug(sandboxCreationProgress, `resume - pollStatusAndAuth sandboxProcessObj, max wait time of ${wait.minutes} minutes`);
188
188
  return this.pollStatusAndAuth({
189
189
  sandboxProcessObj: sandboxCreationProgress,
190
190
  wait,
@@ -752,7 +752,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
752
752
  */
753
753
  async init() {
754
754
  const stateAggregator = await stateAggregator_1.StateAggregator.getInstance();
755
- this.logger = await logger_1.Logger.child('Org');
755
+ this.logger = (await logger_1.Logger.child('Org')).getRawLogger();
756
756
  this.configAggregator = this.options.aggregator ? this.options.aggregator : await configAggregator_1.ConfigAggregator.create();
757
757
  if (!this.options.connection) {
758
758
  if (this.options.aliasOrUsername == null) {
@@ -809,7 +809,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
809
809
  interval: kit_1.Duration.seconds(30),
810
810
  }) {
811
811
  const [wait, pollInterval] = this.validateWaitOptions(options);
812
- this.logger.debug(`AuthWithRetries sandboxProcessObj ${JSON.stringify(sandboxProcessObj, undefined, 2)}, max wait time of ${wait.minutes} minutes`);
812
+ this.logger.debug(sandboxProcessObj, `AuthWithRetries sandboxProcessObj, max wait time of ${wait.minutes} minutes`);
813
813
  return this.pollStatusAndAuth({
814
814
  sandboxProcessObj,
815
815
  wait,
@@ -824,10 +824,10 @@ class Org extends kit_1.AsyncOptionalCreatable {
824
824
  */
825
825
  async queryLatestSandboxProcessBySandboxName(sandboxNameIn) {
826
826
  const { tooling } = this.getConnection();
827
- this.logger.debug('QueryLatestSandboxProcessBySandboxName called with SandboxName: %s ', sandboxNameIn);
827
+ this.logger.debug(`QueryLatestSandboxProcessBySandboxName called with SandboxName: ${sandboxNameIn}`);
828
828
  const queryStr = `SELECT Id, Status, SandboxName, SandboxInfoId, LicenseType, CreatedDate, CopyProgress, SandboxOrganization, SourceId, Description, EndDate FROM SandboxProcess WHERE SandboxName='${sandboxNameIn}' AND Status != 'D' ORDER BY CreatedDate DESC LIMIT 1`;
829
829
  const queryResult = await tooling.query(queryStr);
830
- this.logger.debug('Return from calling queryToolingApi: %s ', queryResult);
830
+ this.logger.debug(queryResult, 'Return from calling queryToolingApi');
831
831
  if (queryResult?.records?.length === 1) {
832
832
  return queryResult.records[0];
833
833
  }
@@ -898,7 +898,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
898
898
  }
899
899
  if (sandboxInfoId) {
900
900
  const deleteResult = await this.destroySandbox(prodOrg, sandboxInfoId);
901
- this.logger.debug('Return from calling tooling.delete: ', deleteResult);
901
+ this.logger.debug(deleteResult, 'Return from calling tooling.delete');
902
902
  }
903
903
  // cleanup remaining artifacts
904
904
  await this.remove();
@@ -1015,10 +1015,11 @@ class Org extends kit_1.AsyncOptionalCreatable {
1015
1015
  await stateAggregator.sandboxes.remove(this.getOrgId());
1016
1016
  }
1017
1017
  async writeSandboxAuthFile(sandboxProcessObj, sandboxRes) {
1018
- this.logger.debug(`writeSandboxAuthFile sandboxProcessObj: ${JSON.stringify(sandboxProcessObj)}, sandboxRes: ${JSON.stringify(sandboxRes)}`);
1018
+ this.logger.debug(sandboxProcessObj, 'writeSandboxAuthFile sandboxProcessObj');
1019
+ this.logger.debug(sandboxRes, 'writeSandboxAuthFile sandboxRes');
1019
1020
  if (sandboxRes.authUserName) {
1020
1021
  const productionAuthFields = this.connection.getAuthInfoFields();
1021
- this.logger.debug('Result from getAuthInfoFields: AuthFields', productionAuthFields);
1022
+ this.logger.debug(productionAuthFields, 'Result from getAuthInfoFields: AuthFields');
1022
1023
  // let's do headless auth via jwt (if we have privateKey) or web auth
1023
1024
  const oauth2Options = {
1024
1025
  loginUrl: sandboxRes.loginUrl,
@@ -1039,7 +1040,11 @@ class Org extends kit_1.AsyncOptionalCreatable {
1039
1040
  oauth2Options,
1040
1041
  parentUsername: productionAuthFields.username,
1041
1042
  });
1042
- this.logger.debug('Creating AuthInfo for sandbox', sandboxRes.authUserName, productionAuthFields.username, oauth2Options);
1043
+ this.logger.debug({
1044
+ sandboxResAuthUsername: sandboxRes.authUserName,
1045
+ productionAuthFieldsUsername: productionAuthFields.username,
1046
+ ...oauth2Options,
1047
+ }, 'Creating AuthInfo for sandbox');
1043
1048
  // save auth info for new sandbox
1044
1049
  await authInfo.save();
1045
1050
  const sandboxOrgId = authInfo.getFields().orgId;
@@ -1069,7 +1074,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
1069
1074
  }
1070
1075
  }
1071
1076
  async pollStatusAndAuth(options) {
1072
- this.logger.debug('PollStatusAndAuth called with SandboxProcessObject', options.sandboxProcessObj, options.wait.minutes, options.pollInterval.seconds);
1077
+ this.logger.debug(options, 'PollStatusAndAuth called with SandboxProcessObject');
1073
1078
  let remainingWait = options.wait;
1074
1079
  let waitingOnAuth = false;
1075
1080
  const pollingClient = await pollingClient_1.PollingClient.create({
@@ -1080,7 +1085,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
1080
1085
  if (sandboxInfo) {
1081
1086
  await lifecycleEvents_1.Lifecycle.getInstance().emit(SandboxEvents.EVENT_AUTH, sandboxInfo);
1082
1087
  try {
1083
- this.logger.debug('sandbox signup complete with', sandboxInfo);
1088
+ this.logger.debug(sandboxInfo, 'sandbox signup complete with');
1084
1089
  await this.writeSandboxAuthFile(sandboxProcessObj, sandboxInfo);
1085
1090
  return { completed: true, payload: sandboxProcessObj };
1086
1091
  }
@@ -1142,7 +1147,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
1142
1147
  sandboxName: sandboxProcessObj.SandboxName,
1143
1148
  callbackUrl,
1144
1149
  };
1145
- this.logger.debug('Calling sandboxAuth with SandboxUserAuthRequest', sandboxReq);
1150
+ this.logger.debug(sandboxReq, 'Calling sandboxAuth with SandboxUserAuthRequest');
1146
1151
  // eslint-disable-next-line no-underscore-dangle
1147
1152
  const url = `${this.connection.tooling._baseUrl()}/sandboxAuth`;
1148
1153
  const params = {
@@ -1152,7 +1157,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
1152
1157
  body: JSON.stringify(sandboxReq),
1153
1158
  };
1154
1159
  const result = await this.connection.tooling.request(params);
1155
- this.logger.debug('Result of calling sandboxAuth', result);
1160
+ this.logger.debug(result, 'Result of calling sandboxAuth');
1156
1161
  return result;
1157
1162
  }
1158
1163
  catch (err) {
@@ -10,7 +10,7 @@ exports.PermissionSetAssignment = void 0;
10
10
  const os_1 = require("os");
11
11
  const kit_1 = require("@salesforce/kit");
12
12
  const ts_types_1 = require("@salesforce/ts-types");
13
- const logger_1 = require("../logger");
13
+ const logger_1 = require("../logger/logger");
14
14
  const messages_1 = require("../messages");
15
15
  const sfError_1 = require("../sfError");
16
16
  const messages = new messages_1.Messages('@salesforce/core', 'permissionSetAssignment', new Map([["orgRequired", "An Org instance is required."], ["userIdRequired", "A Salesforce id for the user is required."], ["permSetRequired", "The name of a permission set is required."], ["unexpectedType", "An unexpected response was returned from the permission set assignment."], ["assignCommandPermissionSetNotFoundError", "Permission set \"%s\" not found in target org. Do you need to push source?"], ["assignCommandPermissionSetNotFoundForNSError", "Permission set \"%s\" for namespace \"%s\" not found in target org. Do you need to push source or install the package?"], ["errorsEncounteredCreatingAssignment", "Error(s) were reported."], ["notSuccessfulButNoErrorsReported", "The permission set assignment failed but no errors were reported."]]));
@@ -10,7 +10,7 @@ exports.scratchOrgCreate = exports.scratchOrgResume = exports.DEFAULT_STREAM_TIM
10
10
  const kit_1 = require("@salesforce/kit");
11
11
  const ts_types_1 = require("@salesforce/ts-types");
12
12
  const messages_1 = require("../messages");
13
- const logger_1 = require("../logger");
13
+ const logger_1 = require("../logger/logger");
14
14
  const configAggregator_1 = require("../config/configAggregator");
15
15
  const orgConfigProperties_1 = require("../org/orgConfigProperties");
16
16
  const sfProject_1 = require("../sfProject");
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.checkScratchOrgInfoForErrors = exports.validateScratchOrgInfoForResume = void 0;
10
10
  const messages_1 = require("../messages");
11
11
  const sfError_1 = require("../sfError");
12
- const logger_1 = require("../logger");
12
+ const logger_1 = require("../logger/logger");
13
13
  const scratchOrgCache_1 = require("./scratchOrgCache");
14
14
  const scratchOrgLifecycleEvents_1 = require("./scratchOrgLifecycleEvents");
15
15
  const WORKSPACE_CONFIG_FILENAME = 'sfdx-project.json';
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.updateRevisionCounterToZero = exports.resolveUrl = exports.deploySettings = exports.pollForScratchOrgInfo = exports.requestScratchOrgCreation = exports.authorizeScratchOrg = exports.queryScratchOrgInfo = void 0;
10
10
  const kit_1 = require("@salesforce/kit");
11
11
  const ts_retry_promise_1 = require("ts-retry-promise");
12
- const logger_1 = require("../logger");
12
+ const logger_1 = require("../logger/logger");
13
13
  const messages_1 = require("../messages");
14
14
  const sfError_1 = require("../sfError");
15
15
  const sfdcUrl_1 = require("../util/sfdcUrl");
@@ -8,7 +8,6 @@ exports.emitPostOrgCreate = exports.emit = exports.scratchOrgLifecycleStages = e
8
8
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
9
9
  */
10
10
  const lifecycleEvents_1 = require("../lifecycleEvents");
11
- const emitter = lifecycleEvents_1.Lifecycle.getInstance();
12
11
  exports.scratchOrgLifecycleEventName = 'scratchOrgLifecycleEvent';
13
12
  exports.scratchOrgLifecycleStages = [
14
13
  'prepare request',
@@ -19,7 +18,7 @@ exports.scratchOrgLifecycleStages = [
19
18
  'deploy settings',
20
19
  'done',
21
20
  ];
22
- const emit = async (event) => emitter.emit(exports.scratchOrgLifecycleEventName, event);
21
+ const emit = async (event) => lifecycleEvents_1.Lifecycle.getInstance().emit(exports.scratchOrgLifecycleEventName, event);
23
22
  exports.emit = emit;
24
23
  const postOrgCreateHookFields = [
25
24
  'accessToken',
@@ -35,7 +34,7 @@ const postOrgCreateHookFields = [
35
34
  ];
36
35
  const isHookField = (key) => postOrgCreateHookFields.includes(key);
37
36
  const emitPostOrgCreate = async (authFields) => {
38
- await emitter.emit('postorgcreate', Object.fromEntries(Object.entries(authFields).filter(([key]) => isHookField(key))));
37
+ await lifecycleEvents_1.Lifecycle.getInstance().emit('postorgcreate', Object.fromEntries(Object.entries(authFields).filter(([key]) => isHookField(key))));
39
38
  };
40
39
  exports.emitPostOrgCreate = emitPostOrgCreate;
41
40
  //# sourceMappingURL=scratchOrgLifecycleEvents.js.map
@@ -11,7 +11,7 @@ const path = require("path");
11
11
  const kit_1 = require("@salesforce/kit");
12
12
  const ts_types_1 = require("@salesforce/ts-types");
13
13
  const js2xmlparser = require("js2xmlparser");
14
- const logger_1 = require("../logger");
14
+ const logger_1 = require("../logger/logger");
15
15
  const sfError_1 = require("../sfError");
16
16
  const pollingClient_1 = require("../status/pollingClient");
17
17
  const zipWriter_1 = require("../util/zipWriter");
package/lib/org/user.js CHANGED
@@ -11,7 +11,7 @@ const os_1 = require("os");
11
11
  const kit_1 = require("@salesforce/kit");
12
12
  const ts_types_1 = require("@salesforce/ts-types");
13
13
  const http_api_1 = require("jsforce/lib/http-api");
14
- const logger_1 = require("../logger");
14
+ const logger_1 = require("../logger/logger");
15
15
  const messages_1 = require("../messages");
16
16
  const secureBuffer_1 = require("../crypto/secureBuffer");
17
17
  const sfError_1 = require("../sfError");
@@ -1,5 +1,5 @@
1
1
  import { JsonMap } from '@salesforce/ts-types';
2
- import { Logger } from '../logger';
2
+ import { Logger } from '../logger/logger';
3
3
  /**
4
4
  * Renders schema properties. By default, this is simply an identity transform. Subclasses may provide more
5
5
  * interesting decorations of each values, such as ANSI coloring.
@@ -1,5 +1,5 @@
1
1
  import { AnyJson, JsonMap } from '@salesforce/ts-types';
2
- import { Logger } from '../logger';
2
+ import { Logger } from '../logger/logger';
3
3
  /**
4
4
  * Loads a JSON schema and performs validations against JSON objects.
5
5
  */
@@ -12,7 +12,7 @@ const path = require("path");
12
12
  const kit_1 = require("@salesforce/kit");
13
13
  const authInfoConfig_1 = require("../../config/authInfoConfig");
14
14
  const global_1 = require("../../global");
15
- const logger_1 = require("../../logger");
15
+ const logger_1 = require("../../logger/logger");
16
16
  const messages_1 = require("../../messages");
17
17
  const lifecycleEvents_1 = require("../../lifecycleEvents");
18
18
  function chunk(array, chunkSize) {
@@ -12,7 +12,7 @@ const url_1 = require("url");
12
12
  const util_1 = require("util");
13
13
  const ts_types_1 = require("@salesforce/ts-types");
14
14
  const kit_1 = require("@salesforce/kit");
15
- const logger_1 = require("../logger");
15
+ const logger_1 = require("../logger/logger");
16
16
  const sfdcUrl_1 = require("../util/sfdcUrl");
17
17
  const pollingClient_1 = require("./pollingClient");
18
18
  // Timeout for DNS lookup polling defaults to 3 seconds and should always be at least 3 seconds
@@ -1,6 +1,6 @@
1
1
  import { AsyncOptionalCreatable, Duration } from '@salesforce/kit';
2
2
  import { AnyJson } from '@salesforce/ts-types';
3
- import { Logger } from '../logger';
3
+ import { Logger } from '../logger/logger';
4
4
  import { StatusResult } from './types';
5
5
  /**
6
6
  * This is a polling client that can be used to poll the status of long running tasks. It can be used as a replacement
@@ -10,7 +10,7 @@ exports.PollingClient = void 0;
10
10
  const kit_1 = require("@salesforce/kit");
11
11
  const ts_types_1 = require("@salesforce/ts-types");
12
12
  const ts_retry_promise_1 = require("ts-retry-promise");
13
- const logger_1 = require("../logger");
13
+ const logger_1 = require("../logger/logger");
14
14
  const sfError_1 = require("../sfError");
15
15
  const lifecycleEvents_1 = require("../lifecycleEvents");
16
16
  /**
@@ -12,7 +12,7 @@ const url_1 = require("url");
12
12
  const lib_1 = require("@salesforce/kit/lib");
13
13
  const lib_2 = require("@salesforce/ts-types/lib");
14
14
  const Faye = require("faye");
15
- const logger_1 = require("../logger");
15
+ const logger_1 = require("../logger/logger");
16
16
  const sfError_1 = require("../sfError");
17
17
  const messages_1 = require("../messages");
18
18
  const types_1 = require("./types");
@@ -4,7 +4,7 @@ import { SinonSandbox, SinonStatic, SinonStub } from 'sinon';
4
4
  import { AnyJson, JsonMap, Optional } from '@salesforce/ts-types';
5
5
  import { ConfigContents } from './config/configStore';
6
6
  import { Connection } from './org/connection';
7
- import { Logger } from './logger';
7
+ import { Logger } from './logger/logger';
8
8
  import { SfError } from './sfError';
9
9
  import { CometClient, CometSubscription, Message, StreamingExtension } from './status/streamingClient';
10
10
  import { AuthFields, SandboxFields } from './org';
package/lib/testSetup.js CHANGED
@@ -24,7 +24,7 @@ const configAggregator_1 = require("./config/configAggregator");
24
24
  const configFile_1 = require("./config/configFile");
25
25
  const connection_1 = require("./org/connection");
26
26
  const crypto_2 = require("./crypto/crypto");
27
- const logger_1 = require("./logger");
27
+ const logger_1 = require("./logger/logger");
28
28
  const messages_1 = require("./messages");
29
29
  const sfError_1 = require("./sfError");
30
30
  const sfProject_1 = require("./sfProject");
@@ -64,7 +64,7 @@ class TestContext {
64
64
  FS: sinon.createSandbox(),
65
65
  ORGS: sinon.createSandbox(),
66
66
  };
67
- this.TEST_LOGGER = new logger_1.Logger({ name: 'SFDX_Core_Test_Logger' }).useMemoryLogging();
67
+ this.TEST_LOGGER = new logger_1.Logger({ name: 'SFDX_Core_Test_Logger', useMemoryLogger: true });
68
68
  if (opts.setup) {
69
69
  this.setup();
70
70
  }
@@ -44,6 +44,8 @@ export declare const validatePathDoesNotContainInvalidChars: (value: string) =>
44
44
  * @param sectionBlocklist properties in the object to exclude from the search. e.g. a blocklist of `["a"]` and data of `{ "a": { "B" : "b"}}` would ignore `B` because it is in the object value under `a`.
45
45
  */
46
46
  export declare const findUpperCaseKeys: (data?: JsonMap, sectionBlocklist?: string[]) => Optional<string>;
47
+ export declare const accessTokenRegex: RegExp;
48
+ export declare const sfdxAuthUrlRegex: RegExp;
47
49
  /**
48
50
  * Tests whether a given string is an access token
49
51
  *
package/lib/util/sfdc.js CHANGED
@@ -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.matchesAccessToken = exports.findUpperCaseKeys = exports.validatePathDoesNotContainInvalidChars = exports.validateSalesforceId = exports.isInternalUrl = exports.validateEmail = exports.validateApiVersion = exports.trimTo15 = void 0;
9
+ exports.matchesAccessToken = exports.sfdxAuthUrlRegex = exports.accessTokenRegex = exports.findUpperCaseKeys = exports.validatePathDoesNotContainInvalidChars = exports.validateSalesforceId = exports.isInternalUrl = exports.validateEmail = exports.validateApiVersion = exports.trimTo15 = void 0;
10
10
  const kit_1 = require("@salesforce/kit");
11
11
  const ts_types_1 = require("@salesforce/ts-types");
12
12
  const sfdcUrl_1 = require("./sfdcUrl");
@@ -80,11 +80,13 @@ const findUpperCaseKeys = (data, sectionBlocklist = []) => {
80
80
  return key;
81
81
  };
82
82
  exports.findUpperCaseKeys = findUpperCaseKeys;
83
+ exports.accessTokenRegex = /(00D\w{12,15})![.\w]*/;
84
+ exports.sfdxAuthUrlRegex = /force:\/\/([a-zA-Z0-9._-]+):([a-zA-Z0-9._-]*):([a-zA-Z0-9._-]+={0,2})@([a-zA-Z0-9._-]+)/;
83
85
  /**
84
86
  * Tests whether a given string is an access token
85
87
  *
86
88
  * @param value
87
89
  */
88
- const matchesAccessToken = (value) => /^(00D\w{12,15})![.\w]*$/.test(value);
90
+ const matchesAccessToken = (value) => exports.accessTokenRegex.test(value);
89
91
  exports.matchesAccessToken = matchesAccessToken;
90
92
  //# sourceMappingURL=sfdc.js.map
@@ -11,7 +11,7 @@ const url_1 = require("url");
11
11
  const kit_1 = require("@salesforce/kit");
12
12
  const ts_types_1 = require("@salesforce/ts-types");
13
13
  const myDomainResolver_1 = require("../status/myDomainResolver");
14
- const logger_1 = require("../logger");
14
+ const logger_1 = require("../logger/logger");
15
15
  const lifecycleEvents_1 = require("../lifecycleEvents");
16
16
  function getLoginAudienceCombos(audienceUrl, loginUrl) {
17
17
  const filtered = [
@@ -0,0 +1 @@
1
+ export declare const unwrapArray: (args: unknown) => unknown;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.unwrapArray = void 0;
4
+ /*
5
+ * Copyright (c) 2023, 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 unwrapArray = (args) => {
11
+ if (Array.isArray(args) && args.length === 1) {
12
+ return Array.isArray(args[0]) ? (0, exports.unwrapArray)(args[0]) : args[0];
13
+ }
14
+ return args;
15
+ };
16
+ exports.unwrapArray = unwrapArray;
17
+ //# sourceMappingURL=unwrapArray.js.map
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.ZipWriter = void 0;
10
10
  const stream_1 = require("stream");
11
11
  const JSZip = require("jszip");
12
- const logger_1 = require("../logger");
12
+ const logger_1 = require("../logger/logger");
13
13
  const sfError_1 = require("../sfError");
14
14
  class ZipWriter extends stream_1.Writable {
15
15
  constructor(rootDestination) {
@@ -17,7 +17,7 @@ const events_1 = require("events");
17
17
  const jsforce_1 = require("jsforce");
18
18
  const kit_1 = require("@salesforce/kit");
19
19
  const ts_types_1 = require("@salesforce/ts-types");
20
- const logger_1 = require("./logger");
20
+ const logger_1 = require("./logger/logger");
21
21
  const org_1 = require("./org");
22
22
  const sfError_1 = require("./sfError");
23
23
  const messages_1 = require("./messages");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core",
3
- "version": "4.3.11",
3
+ "version": "5.0.1-v5-beta.1",
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",
@@ -39,20 +39,21 @@
39
39
  "messageTransformer/messageTransformer.ts"
40
40
  ],
41
41
  "dependencies": {
42
- "@salesforce/bunyan": "^2.0.0",
43
42
  "@salesforce/kit": "^3.0.4",
44
43
  "@salesforce/schemas": "^1.6.0",
45
44
  "@salesforce/ts-types": "^2.0.2",
46
45
  "@types/semver": "^7.5.0",
47
46
  "ajv": "^8.12.0",
48
47
  "change-case": "^4.1.2",
49
- "debug": "^3.2.7",
50
48
  "faye": "^1.4.0",
51
49
  "form-data": "^4.0.0",
52
50
  "js2xmlparser": "^4.0.1",
53
51
  "jsforce": "^2.0.0-beta.27",
54
52
  "jsonwebtoken": "9.0.1",
55
53
  "jszip": "3.10.1",
54
+ "pino": "^8.14.1",
55
+ "pino-abstract-transport": "^1.0.0",
56
+ "pino-pretty": "^10.0.0",
56
57
  "proper-lockfile": "^4.1.2",
57
58
  "ts-retry-promise": "^0.7.0"
58
59
  },
@@ -63,7 +64,6 @@
63
64
  "@salesforce/ts-sinon": "^1.4.9",
64
65
  "@types/benchmark": "^2.1.2",
65
66
  "@types/chai-string": "^1.4.2",
66
- "@types/debug": "0.0.31",
67
67
  "@types/jsonwebtoken": "9.0.2",
68
68
  "@types/lodash": "^4.14.195",
69
69
  "@types/proper-lockfile": "^4.1.2",
@@ -174,4 +174,4 @@
174
174
  ]
175
175
  }
176
176
  }
177
- }
177
+ }