@salesforce/core 6.5.5 → 6.6.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/lib/org/org.js CHANGED
@@ -6,10 +6,33 @@
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
  /* eslint-disable class-methods-use-this */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
25
+ var __importStar = (this && this.__importStar) || function (mod) {
26
+ if (mod && mod.__esModule) return mod;
27
+ var result = {};
28
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
+ __setModuleDefault(result, mod);
30
+ return result;
31
+ };
9
32
  Object.defineProperty(exports, "__esModule", { value: true });
10
33
  exports.Org = exports.sandboxIsResumable = exports.SandboxEvents = exports.OrgTypes = void 0;
11
34
  const node_path_1 = require("node:path");
12
- const fs = require("node:fs");
35
+ const fs = __importStar(require("node:fs"));
13
36
  const kit_1 = require("@salesforce/kit");
14
37
  const ts_types_1 = require("@salesforce/ts-types");
15
38
  const config_1 = require("../config/config");
@@ -29,7 +52,7 @@ const authInfo_1 = require("./authInfo");
29
52
  const scratchOrgCreate_1 = require("./scratchOrgCreate");
30
53
  const orgConfigProperties_1 = require("./orgConfigProperties");
31
54
  ;
32
- const messages = new messages_1.Messages('@salesforce/core', 'org', new Map([["notADevHub", "The provided dev hub username %s is not a valid dev hub."], ["noUsernameFound", "No username found."], ["noDevHubFound", "Unable to associate this scratch org with a DevHub."], ["deleteOrgHubError", "The Dev Hub org cannot be deleted."], ["insufficientAccessToDelete", "You do not have the appropriate permissions to delete a scratch org. Please contact your Salesforce admin."], ["scratchOrgNotFound", "Attempting to delete an expired or deleted org"], ["sandboxDeleteFailed", "The sandbox org deletion failed with a result of %s."], ["sandboxNotFound", "We can't find a SandboxProcess for the sandbox %s."], ["sandboxInfoCreateFailed", "The sandbox org creation failed with a result of %s."], ["missingAuthUsername", "The sandbox %s does not have an authorized username."], ["orgPollingTimeout", "Sandbox status is %s; timed out waiting for completion."], ["NotFoundOnDevHub", "The scratch org does not belong to the dev hub username %s."], ["AuthInfoOrgIdUndefined", "AuthInfo orgId is undefined."], ["sandboxCreateNotComplete", "The sandbox creation has not completed."], ["SandboxProcessNotFoundBySandboxName", "We can't find a SandboxProcess with the SandboxName %s."], ["MultiSandboxProcessNotFoundBySandboxName", "We found more than one SandboxProcess with the SandboxName %s."], ["sandboxNotResumable", "The sandbox %s cannot resume with status of %s."]]));
55
+ const messages = new messages_1.Messages('@salesforce/core', 'org', new Map([["notADevHub", "The provided dev hub username %s is not a valid dev hub."], ["noUsernameFound", "No username found."], ["noDevHubFound", "Unable to associate this scratch org with a DevHub."], ["deleteOrgHubError", "The Dev Hub org cannot be deleted."], ["insufficientAccessToDelete", "You do not have the appropriate permissions to delete a scratch org. Please contact your Salesforce admin."], ["scratchOrgNotFound", "Attempting to delete an expired or deleted org"], ["sandboxDeleteFailed", "The sandbox org deletion failed with a result of %s."], ["sandboxNotFound", "We can't find a SandboxProcess for the sandbox %s."], ["sandboxInfoCreateFailed", "The sandbox org creation failed with a result of %s."], ["sandboxInfoRefreshFailed", "The sandbox org refresh failed with a result of %s."], ["missingAuthUsername", "The sandbox %s does not have an authorized username."], ["orgPollingTimeout", "Sandbox status is %s; timed out waiting for completion."], ["NotFoundOnDevHub", "The scratch org does not belong to the dev hub username %s."], ["AuthInfoOrgIdUndefined", "AuthInfo orgId is undefined."], ["sandboxCreateNotComplete", "The sandbox creation has not completed."], ["SandboxProcessNotFoundBySandboxName", "We can't find a SandboxProcess with the SandboxName %s."], ["MultiSandboxProcessNotFoundBySandboxName", "We found more than one SandboxProcess with the SandboxName %s."], ["sandboxNotResumable", "The sandbox %s cannot resume with status of %s."]]));
33
56
  var OrgTypes;
34
57
  (function (OrgTypes) {
35
58
  OrgTypes["Scratch"] = "scratch";
@@ -49,6 +72,19 @@ function sandboxIsResumable(value) {
49
72
  return resumableSandboxStatus.includes(value);
50
73
  }
51
74
  exports.sandboxIsResumable = sandboxIsResumable;
75
+ const sandboxProcessFields = [
76
+ 'Id',
77
+ 'Status',
78
+ 'SandboxName',
79
+ 'SandboxInfoId',
80
+ 'LicenseType',
81
+ 'CreatedDate',
82
+ 'CopyProgress',
83
+ 'SandboxOrganization',
84
+ 'SourceId',
85
+ 'Description',
86
+ 'EndDate',
87
+ ];
52
88
  /**
53
89
  * Provides a way to manage a locally authenticated Org.
54
90
  *
@@ -118,6 +154,46 @@ class Org extends kit_1.AsyncOptionalCreatable {
118
154
  pollInterval,
119
155
  });
120
156
  }
157
+ /**
158
+ * Refresh (update) a sandbox from a production org.
159
+ * 'this' needs to be a production org with sandbox licenses available
160
+ *
161
+ * @param sandboxInfo SandboxInfo to update the sandbox with
162
+ * @param options Wait: The amount of time to wait before timing out, Interval: The time interval between polling
163
+ */
164
+ async refreshSandbox(sandboxInfo, options = {
165
+ wait: kit_1.Duration.minutes(6),
166
+ async: false,
167
+ interval: kit_1.Duration.seconds(30),
168
+ }) {
169
+ this.logger.debug(sandboxInfo, 'RefreshSandbox called with SandboxInfo');
170
+ const refreshResult = await this.connection.tooling.update('SandboxInfo', sandboxInfo);
171
+ this.logger.debug(refreshResult, 'Return from calling tooling.update');
172
+ if (!refreshResult.success) {
173
+ throw messages.createError('sandboxInfoRefreshFailed', [JSON.stringify(refreshResult)]);
174
+ }
175
+ const soql = `SELECT ${sandboxProcessFields.join(',')} FROM SandboxProcess WHERE SandboxName='${sandboxInfo.SandboxName}' ORDER BY CreatedDate DESC`;
176
+ const sbxProcessObjects = (await this.connection.tooling.query(soql)).records.filter((item) => !item.Status.startsWith('Del'));
177
+ this.logger.debug(sbxProcessObjects, `SandboxProcesses for ${sandboxInfo.SandboxName}`);
178
+ // throw if none found
179
+ if (sbxProcessObjects?.length === 0) {
180
+ throw new Error(`No SandboxProcesses found for: ${sandboxInfo.SandboxName}`);
181
+ }
182
+ const sandboxRefreshProgress = sbxProcessObjects[0];
183
+ const isAsync = !!options.async;
184
+ if (isAsync) {
185
+ // The user didn't want us to poll, so simply return the status
186
+ await lifecycleEvents_1.Lifecycle.getInstance().emit(SandboxEvents.EVENT_ASYNC_RESULT, sandboxRefreshProgress);
187
+ return sandboxRefreshProgress;
188
+ }
189
+ const [wait, pollInterval] = this.validateWaitOptions(options);
190
+ this.logger.debug(sandboxRefreshProgress, `refresh - pollStatusAndAuth sandboxProcessObj, max wait time of ${wait.minutes} minutes`);
191
+ return this.pollStatusAndAuth({
192
+ sandboxProcessObj: sandboxRefreshProgress,
193
+ wait,
194
+ pollInterval,
195
+ });
196
+ }
121
197
  /**
122
198
  *
123
199
  * @param sandboxReq SandboxRequest options to create the sandbox with
@@ -131,10 +207,10 @@ class Org extends kit_1.AsyncOptionalCreatable {
131
207
  return this.createSandbox(sandboxReq, options);
132
208
  }
133
209
  /**
134
- * Resume a sandbox creation from a production org.
210
+ * Resume a sandbox create or refresh from a production org.
135
211
  * `this` needs to be a production org with sandbox licenses available.
136
212
  *
137
- * @param resumeSandboxRequest SandboxRequest options to create the sandbox with
213
+ * @param resumeSandboxRequest SandboxRequest options to create/refresh the sandbox with
138
214
  * @param options Wait: The amount of time to wait (default: 0 minutes) before timing out,
139
215
  * Interval: The time interval (default: 30 seconds) between polling
140
216
  */
@@ -838,7 +914,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
838
914
  async queryLatestSandboxProcessBySandboxName(sandboxNameIn) {
839
915
  const { tooling } = this.getConnection();
840
916
  this.logger.debug(`QueryLatestSandboxProcessBySandboxName called with SandboxName: ${sandboxNameIn}`);
841
- 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`;
917
+ const queryStr = `SELECT ${sandboxProcessFields.join(',')} FROM SandboxProcess WHERE SandboxName='${sandboxNameIn}' AND Status != 'D' ORDER BY CreatedDate DESC LIMIT 1`;
842
918
  const queryResult = await tooling.query(queryStr);
843
919
  this.logger.debug(queryResult, 'Return from calling queryToolingApi');
844
920
  if (queryResult?.records?.length === 1) {
@@ -1048,6 +1124,17 @@ class Org extends kit_1.AsyncOptionalCreatable {
1048
1124
  oauth2Options.privateKey = productionAuthFields.privateKey;
1049
1125
  oauth2Options.clientId = productionAuthFields.clientId;
1050
1126
  }
1127
+ // Before creating the AuthInfo, delete any existing auth files for the sandbox.
1128
+ // This is common when refreshing sandboxes, and will cause AuthInfo to throw
1129
+ // because it doesn't want to overwrite existing auth files.
1130
+ const stateAggregator = await stateAggregator_1.StateAggregator.getInstance();
1131
+ try {
1132
+ await stateAggregator.orgs.read(sandboxRes.authUserName);
1133
+ await stateAggregator.orgs.remove(sandboxRes.authUserName);
1134
+ }
1135
+ catch (e) {
1136
+ // ignore since this is only for deleting existing auth files.
1137
+ }
1051
1138
  const authInfo = await authInfo_1.AuthInfo.create({
1052
1139
  username: sandboxRes.authUserName,
1053
1140
  oauth2Options,
@@ -1058,8 +1145,11 @@ class Org extends kit_1.AsyncOptionalCreatable {
1058
1145
  productionAuthFieldsUsername: productionAuthFields.username,
1059
1146
  ...oauth2Options,
1060
1147
  }, 'Creating AuthInfo for sandbox');
1061
- // save auth info for new sandbox
1062
- await authInfo.save();
1148
+ // save auth info for sandbox
1149
+ await authInfo.save({
1150
+ isScratch: false,
1151
+ isSandbox: true,
1152
+ });
1063
1153
  const sandboxOrgId = authInfo.getFields().orgId;
1064
1154
  if (!sandboxOrgId) {
1065
1155
  throw messages.createError('AuthInfoOrgIdUndefined');
@@ -1134,7 +1224,7 @@ class Org extends kit_1.AsyncOptionalCreatable {
1134
1224
  * @private
1135
1225
  */
1136
1226
  async querySandboxProcess(where) {
1137
- const soql = `SELECT Id, Status, SandboxName, SandboxInfoId, LicenseType, CreatedDate, CopyProgress, SandboxOrganization, SourceId, Description, EndDate FROM SandboxProcess WHERE ${where} ORDER BY CreatedDate DESC`;
1227
+ const soql = `SELECT ${sandboxProcessFields.join(',')} FROM SandboxProcess WHERE ${where} ORDER BY CreatedDate DESC`;
1138
1228
  const result = (await this.connection.tooling.query(soql)).records.filter((item) => !item.Status.startsWith('Del'));
1139
1229
  if (result.length === 0) {
1140
1230
  throw new sfError_1.SfError(`No record found for ${soql}`, connection_1.SingleRecordQueryErrors.NoRecords);
@@ -1181,15 +1271,15 @@ class Org extends kit_1.AsyncOptionalCreatable {
1181
1271
  return result;
1182
1272
  }
1183
1273
  catch (err) {
1184
- const error = err;
1274
+ const error = err instanceof Error ? err : sfError_1.SfError.wrap((0, ts_types_1.isString)(err) ? err : 'unknown');
1185
1275
  // There are cases where the endDate is set before the sandbox has actually completed.
1186
1276
  // In that case, the sandboxAuth call will throw a specific exception.
1187
1277
  if (error?.name === 'INVALID_STATUS') {
1188
- this.logger.debug('Error while authenticating the user', error?.toString());
1278
+ this.logger.debug('Error while authenticating the user:', error.message);
1189
1279
  }
1190
1280
  else {
1191
- // If it fails for any unexpected reason, just pass that through
1192
- throw sfError_1.SfError.wrap(error);
1281
+ // If it fails for any unexpected reason, rethrow
1282
+ throw error;
1193
1283
  }
1194
1284
  }
1195
1285
  }
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.scratchOrgCreate = exports.scratchOrgResume = exports.DEFAULT_STREAM_TIMEOUT_MINUTES = void 0;
4
7
  /*
@@ -17,7 +20,7 @@ const sfProject_1 = require("../sfProject");
17
20
  const stateAggregator_1 = require("../stateAggregator/stateAggregator");
18
21
  const org_1 = require("./org");
19
22
  const scratchOrgInfoApi_1 = require("./scratchOrgInfoApi");
20
- const scratchOrgSettingsGenerator_1 = require("./scratchOrgSettingsGenerator");
23
+ const scratchOrgSettingsGenerator_1 = __importDefault(require("./scratchOrgSettingsGenerator"));
21
24
  const scratchOrgInfoGenerator_1 = require("./scratchOrgInfoGenerator");
22
25
  const authInfo_1 = require("./authInfo");
23
26
  const scratchOrgLifecycleEvents_1 = require("./scratchOrgLifecycleEvents");
@@ -5,6 +5,9 @@
5
5
  * Licensed under the BSD 3-Clause license.
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
8
11
  Object.defineProperty(exports, "__esModule", { value: true });
9
12
  exports.updateRevisionCounterToZero = exports.resolveUrl = exports.deploySettings = exports.pollForScratchOrgInfo = exports.requestScratchOrgCreation = exports.authorizeScratchOrg = exports.queryScratchOrgInfo = void 0;
10
13
  const kit_1 = require("@salesforce/kit");
@@ -16,7 +19,7 @@ const sfdcUrl_1 = require("../util/sfdcUrl");
16
19
  const pollingClient_1 = require("../status/pollingClient");
17
20
  const myDomainResolver_1 = require("../status/myDomainResolver");
18
21
  const lifecycleEvents_1 = require("../lifecycleEvents");
19
- const mapKeys_1 = require("../util/mapKeys");
22
+ const mapKeys_1 = __importDefault(require("../util/mapKeys"));
20
23
  const authInfo_1 = require("./authInfo");
21
24
  const org_1 = require("./org");
22
25
  const scratchOrgErrorCodes_1 = require("./scratchOrgErrorCodes");
@@ -5,12 +5,35 @@
5
5
  * Licensed under the BSD 3-Clause license.
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
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
+ __setModuleDefault(result, mod);
29
+ return result;
30
+ };
8
31
  Object.defineProperty(exports, "__esModule", { value: true });
9
32
  exports.createRecordTypeAndBusinessProcessFileContent = exports.createObjectFileContent = exports.RequestStatus = void 0;
10
- const path = require("node:path");
33
+ const path = __importStar(require("node:path"));
11
34
  const kit_1 = require("@salesforce/kit");
12
35
  const ts_types_1 = require("@salesforce/ts-types");
13
- const js2xmlparser = require("js2xmlparser");
36
+ const js2xmlparser = __importStar(require("js2xmlparser"));
14
37
  const logger_1 = require("../logger/logger");
15
38
  const sfError_1 = require("../sfError");
16
39
  const pollingClient_1 = require("../status/pollingClient");
@@ -5,11 +5,37 @@
5
5
  * Licensed under the BSD 3-Clause license.
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
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
+ __setModuleDefault(result, mod);
29
+ return result;
30
+ };
31
+ var __importDefault = (this && this.__importDefault) || function (mod) {
32
+ return (mod && mod.__esModule) ? mod : { "default": mod };
33
+ };
8
34
  Object.defineProperty(exports, "__esModule", { value: true });
9
35
  exports.SchemaValidator = void 0;
10
- const path = require("node:path");
11
- const fs = require("node:fs");
12
- const ajv_1 = require("ajv");
36
+ const path = __importStar(require("node:path"));
37
+ const fs = __importStar(require("node:fs"));
38
+ const ajv_1 = __importDefault(require("ajv"));
13
39
  const kit_1 = require("@salesforce/kit");
14
40
  const sfError_1 = require("../sfError");
15
41
  /**
package/lib/sfProject.js CHANGED
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.SfProject = exports.SfProjectJson = void 0;
4
27
  /*
@@ -8,7 +31,7 @@ exports.SfProject = exports.SfProjectJson = void 0;
8
31
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
9
32
  */
10
33
  const node_path_1 = require("node:path");
11
- const fs = require("node:fs");
34
+ const fs = __importStar(require("node:fs"));
12
35
  const kit_1 = require("@salesforce/kit");
13
36
  const ts_types_1 = require("@salesforce/ts-types");
14
37
  const sfdcUrl_1 = require("./util/sfdcUrl");
@@ -5,10 +5,33 @@
5
5
  * Licensed under the BSD 3-Clause license.
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
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
+ __setModuleDefault(result, mod);
29
+ return result;
30
+ };
8
31
  Object.defineProperty(exports, "__esModule", { value: true });
9
32
  exports.OrgAccessor = exports.BaseOrgAccessor = void 0;
10
- const fs = require("node:fs");
11
- const path = require("node:path");
33
+ const fs = __importStar(require("node:fs"));
34
+ const path = __importStar(require("node:path"));
12
35
  const ts_types_1 = require("@salesforce/ts-types");
13
36
  const kit_1 = require("@salesforce/kit");
14
37
  const authInfoConfig_1 = require("../../config/authInfoConfig");
@@ -5,13 +5,16 @@
5
5
  * Licensed under the BSD 3-Clause license.
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
8
11
  Object.defineProperty(exports, "__esModule", { value: true });
9
12
  exports.StreamingClient = exports.CometClient = void 0;
10
13
  /* eslint-disable @typescript-eslint/ban-ts-comment */
11
14
  const node_url_1 = require("node:url");
12
15
  const lib_1 = require("@salesforce/kit/lib");
13
16
  const lib_2 = require("@salesforce/ts-types/lib");
14
- const Faye = require("faye");
17
+ const faye_1 = __importDefault(require("faye"));
15
18
  const logger_1 = require("../logger/logger");
16
19
  const sfError_1 = require("../sfError");
17
20
  const messages_1 = require("../messages");
@@ -362,13 +365,13 @@ exports.StreamingClient = StreamingClient;
362
365
  this.streamingImpl = {
363
366
  getCometClient: (url) =>
364
367
  // @ts-ignore
365
- new Faye.Client(url),
368
+ new faye_1.default.Client(url),
366
369
  setLogger: (logLine) => {
367
370
  // @ts-ignore
368
- Faye.logger = {};
371
+ faye_1.default.logger = {};
369
372
  ['info', 'error', 'fatal', 'warn', 'debug'].forEach((element) => {
370
373
  // @ts-ignore
371
- (0, lib_1.set)(Faye.logger, element, logLine);
374
+ (0, lib_1.set)(faye_1.default.logger, element, logLine);
372
375
  });
373
376
  },
374
377
  };
package/lib/testSetup.js CHANGED
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.MockTestSandboxData = exports.MockTestOrgData = exports.StreamingMockCometClient = exports.StreamingMockCometSubscription = exports.StreamingMockSubscriptionCall = exports.shouldThrowSync = exports.shouldThrow = exports.unexpectedResult = exports.restoreContext = exports.stubContext = exports.instantiateContext = exports.TestContext = exports.uniqid = void 0;
4
27
  /*
@@ -12,7 +35,7 @@ exports.MockTestSandboxData = exports.MockTestOrgData = exports.StreamingMockCom
12
35
  /* eslint-disable @typescript-eslint/no-unsafe-assignment */
13
36
  /* eslint-disable @typescript-eslint/no-unsafe-member-access */
14
37
  /* eslint-disable @typescript-eslint/no-unsafe-call */
15
- const fs = require("node:fs");
38
+ const fs = __importStar(require("node:fs"));
16
39
  const node_events_1 = require("node:events");
17
40
  const node_os_1 = require("node:os");
18
41
  const node_path_1 = require("node:path");
@@ -25,7 +48,7 @@ const logger_1 = require("./logger/logger");
25
48
  const messages_1 = require("./messages");
26
49
  const sfError_1 = require("./sfError");
27
50
  const sfProject_1 = require("./sfProject");
28
- const aliasAccessorEntireFile = require("./stateAggregator/accessors/aliasAccessor");
51
+ const aliasAccessorEntireFile = __importStar(require("./stateAggregator/accessors/aliasAccessor"));
29
52
  const streamingClient_1 = require("./status/streamingClient");
30
53
  const stateAggregator_1 = require("./stateAggregator/stateAggregator");
31
54
  const orgAccessor_1 = require("./stateAggregator/accessors/orgAccessor");
@@ -5,12 +5,35 @@
5
5
  * Licensed under the BSD 3-Clause license.
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
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
+ __setModuleDefault(result, mod);
29
+ return result;
30
+ };
8
31
  Object.defineProperty(exports, "__esModule", { value: true });
9
32
  exports.DirectoryWriter = void 0;
10
33
  const node_stream_1 = require("node:stream");
11
- const fs = require("node:fs");
12
- const os = require("node:os");
13
- const path = require("node:path");
34
+ const fs = __importStar(require("node:fs"));
35
+ const os = __importStar(require("node:os"));
36
+ const path = __importStar(require("node:path"));
14
37
  const node_util_1 = require("node:util");
15
38
  const pipeline = (0, node_util_1.promisify)(node_stream_1.pipeline);
16
39
  class DirectoryWriter {
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.lockInitSync = exports.lockInit = void 0;
4
27
  /*
@@ -7,7 +30,7 @@ exports.lockInitSync = exports.lockInit = void 0;
7
30
  * Licensed under the BSD 3-Clause license.
8
31
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
9
32
  */
10
- const fs = require("node:fs");
33
+ const fs = __importStar(require("node:fs"));
11
34
  const node_path_1 = require("node:path");
12
35
  const proper_lockfile_1 = require("proper-lockfile");
13
36
  const sfError_1 = require("../sfError");
@@ -5,9 +5,32 @@
5
5
  * Licensed under the BSD 3-Clause license.
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
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
+ __setModuleDefault(result, mod);
29
+ return result;
30
+ };
8
31
  Object.defineProperty(exports, "__esModule", { value: true });
9
32
  exports.traverse = exports.resolveProjectPathSync = exports.resolveProjectPath = exports.SFDX_PROJECT_JSON = void 0;
10
- const fs = require("node:fs");
33
+ const fs = __importStar(require("node:fs"));
11
34
  const node_path_1 = require("node:path");
12
35
  const messages_1 = require("../messages");
13
36
  ;
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.uniqid = void 0;
4
27
  /*
@@ -8,7 +31,7 @@ exports.uniqid = void 0;
8
31
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
9
32
  */
10
33
  const node_crypto_1 = require("node:crypto");
11
- const util = require("node:util");
34
+ const util = __importStar(require("node:util"));
12
35
  /**
13
36
  * A function to generate a unique id and return it in the context of a template, if supplied.
14
37
  *
@@ -5,17 +5,20 @@
5
5
  * Licensed under the BSD 3-Clause license.
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
9
+ return (mod && mod.__esModule) ? mod : { "default": mod };
10
+ };
8
11
  Object.defineProperty(exports, "__esModule", { value: true });
9
12
  exports.ZipWriter = void 0;
10
13
  const node_stream_1 = require("node:stream");
11
- const JSZip = require("jszip");
14
+ const jszip_1 = __importDefault(require("jszip"));
12
15
  const logger_1 = require("../logger/logger");
13
16
  const sfError_1 = require("../sfError");
14
17
  class ZipWriter extends node_stream_1.Writable {
15
18
  constructor(rootDestination) {
16
19
  super({ objectMode: true });
17
20
  this.rootDestination = rootDestination;
18
- this.zip = JSZip();
21
+ this.zip = (0, jszip_1.default)();
19
22
  const destination = rootDestination ? `for: ${rootDestination}` : 'in memory';
20
23
  this.logger = logger_1.Logger.childFromRoot(this.constructor.name);
21
24
  this.logger.debug(`generating zip ${destination}`);