@salesforce/core 4.1.3 → 4.2.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.
- package/lib/org/connection.js +1 -1
- package/lib/util/zipWriter.d.ts +2 -3
- package/lib/util/zipWriter.js +23 -40
- package/messages/connection.md +4 -4
- package/package.json +8 -9
package/lib/org/connection.js
CHANGED
|
@@ -21,7 +21,7 @@ const sfdc_1 = require("../util/sfdc");
|
|
|
21
21
|
const messages_1 = require("../messages");
|
|
22
22
|
const lifecycleEvents_1 = require("../lifecycleEvents");
|
|
23
23
|
const orgConfigProperties_1 = require("./orgConfigProperties");
|
|
24
|
-
const messages = new messages_1.Messages('@salesforce/core', 'connection', new Map([["incorrectAPIVersionError", "Invalid API version %s. Expecting format \"[1-9][0-9].0\", i.e. 42.0"], ["domainNotFoundError", "The org cannot be found"], ["domainNotFoundError.actions", ["Verify that the org still exists
|
|
24
|
+
const messages = new messages_1.Messages('@salesforce/core', 'connection', new Map([["incorrectAPIVersionError", "Invalid API version %s. Expecting format \"[1-9][0-9].0\", i.e. 42.0"], ["domainNotFoundError", "The org cannot be found"], ["domainNotFoundError.actions", ["Verify that the org still exists,", "If your org is newly created, wait a minute and run your command again,", "If you deployed or updated the org's My Domain, logout from the CLI and authenticate again,", "If you are running in a CI environment with a DNS that blocks external IPs, try setting SFDX_DISABLE_DNS_CHECK=true"]], ["noInstanceUrlError", "Connection has no instanceUrl."], ["noInstanceUrlError.actions", "Make sure the instanceUrl is set in your command or config."], ["noApiVersionsError", "Org failed to respond with its list of API versions. This is usually the result of domain changes like activating MyDomain or Enhanced Domains"], ["noApiVersionsError.actions", "Re-authenticate to the org."]]));
|
|
25
25
|
const clientId = `sfdx toolbelt:${process.env.SFDX_SET_CLIENT_IDS ?? ''}`;
|
|
26
26
|
exports.SFDX_HTTP_HEADERS = {
|
|
27
27
|
'content-type': 'application/json',
|
package/lib/util/zipWriter.d.ts
CHANGED
|
@@ -5,12 +5,11 @@ import { StructuredWriter } from './structuredWriter';
|
|
|
5
5
|
export declare class ZipWriter extends Writable implements StructuredWriter {
|
|
6
6
|
private readonly rootDestination?;
|
|
7
7
|
private zip;
|
|
8
|
-
private
|
|
8
|
+
private zipBuffer?;
|
|
9
|
+
private logger;
|
|
9
10
|
constructor(rootDestination?: string | undefined);
|
|
10
11
|
get buffer(): Buffer;
|
|
11
12
|
addToStore(contents: string | Readable | Buffer, path: string): Promise<void>;
|
|
12
13
|
finalize(): Promise<void>;
|
|
13
14
|
getDestinationPath(): string | undefined;
|
|
14
|
-
private getOutputStream;
|
|
15
|
-
private getInputBuffer;
|
|
16
15
|
}
|
package/lib/util/zipWriter.js
CHANGED
|
@@ -7,62 +7,45 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.ZipWriter = void 0;
|
|
10
|
-
const fs_1 = require("fs");
|
|
11
10
|
const stream_1 = require("stream");
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
11
|
+
const JSZip = require("jszip");
|
|
12
|
+
const logger_1 = require("../logger");
|
|
13
|
+
const sfError_1 = require("../sfError");
|
|
15
14
|
class ZipWriter extends stream_1.Writable {
|
|
16
15
|
constructor(rootDestination) {
|
|
17
16
|
super({ objectMode: true });
|
|
18
17
|
this.rootDestination = rootDestination;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
this.
|
|
23
|
-
this.buffers = [];
|
|
24
|
-
void pipeline(this.zip, this.getOutputStream());
|
|
18
|
+
this.zip = JSZip();
|
|
19
|
+
const destination = rootDestination ? `for: ${rootDestination}` : 'in memory';
|
|
20
|
+
this.logger = logger_1.Logger.childFromRoot(this.constructor.name);
|
|
21
|
+
this.logger.debug(`generating zip ${destination}`);
|
|
25
22
|
}
|
|
26
23
|
get buffer() {
|
|
27
|
-
|
|
24
|
+
if (!this.zipBuffer) {
|
|
25
|
+
throw new sfError_1.SfError('Must finalize the ZipWriter before getting a buffer');
|
|
26
|
+
}
|
|
27
|
+
return this.zipBuffer;
|
|
28
28
|
}
|
|
29
29
|
async addToStore(contents, path) {
|
|
30
|
-
|
|
30
|
+
// Ensure only posix paths are added to zip files
|
|
31
|
+
const posixPath = path.replace(/\\/g, '/');
|
|
32
|
+
this.zip.file(posixPath, contents);
|
|
31
33
|
return Promise.resolve();
|
|
32
34
|
}
|
|
33
35
|
async finalize() {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
// compression-/speed+ (0)<---(3)---------->(9) compression+/speed-
|
|
37
|
+
// 3 appears to be a decent balance of compression and speed. It felt like
|
|
38
|
+
// higher values = diminishing returns on compression and made conversion slower
|
|
39
|
+
this.zipBuffer = await this.zip.generateAsync({
|
|
40
|
+
type: 'nodebuffer',
|
|
41
|
+
compression: 'DEFLATE',
|
|
42
|
+
compressionOptions: { level: 3 },
|
|
43
|
+
});
|
|
44
|
+
this.logger.debug('Generated zip complete');
|
|
36
45
|
}
|
|
37
46
|
getDestinationPath() {
|
|
38
47
|
return this.rootDestination;
|
|
39
48
|
}
|
|
40
|
-
getOutputStream() {
|
|
41
|
-
if (this.rootDestination) {
|
|
42
|
-
return (0, fs_1.createWriteStream)(this.rootDestination);
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
const bufferWritable = new stream_1.Writable();
|
|
46
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
47
|
-
bufferWritable._write = (chunk, encoding, cb) => {
|
|
48
|
-
this.buffers.push(chunk);
|
|
49
|
-
cb();
|
|
50
|
-
};
|
|
51
|
-
return bufferWritable;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
async getInputBuffer() {
|
|
55
|
-
if (this.rootDestination) {
|
|
56
|
-
const inputStream = (0, fs_1.createReadStream)(this.rootDestination);
|
|
57
|
-
return new Promise((resolve, reject) => {
|
|
58
|
-
inputStream.on('data', (chunk) => {
|
|
59
|
-
this.buffers.push(chunk);
|
|
60
|
-
});
|
|
61
|
-
inputStream.once('end', () => resolve());
|
|
62
|
-
inputStream.once('error', (error) => reject(error));
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
49
|
}
|
|
67
50
|
exports.ZipWriter = ZipWriter;
|
|
68
51
|
//# sourceMappingURL=zipWriter.js.map
|
package/messages/connection.md
CHANGED
|
@@ -8,10 +8,10 @@ The org cannot be found
|
|
|
8
8
|
|
|
9
9
|
# domainNotFoundError.actions
|
|
10
10
|
|
|
11
|
-
- Verify that the org still exists
|
|
12
|
-
- If your org is newly created, wait a minute and run your command again
|
|
13
|
-
- If you deployed or updated the org's My Domain, logout from the CLI and authenticate again
|
|
14
|
-
- If you are running in a CI environment with a DNS that blocks external IPs, try setting SFDX_DISABLE_DNS_CHECK=true
|
|
11
|
+
- Verify that the org still exists,
|
|
12
|
+
- If your org is newly created, wait a minute and run your command again,
|
|
13
|
+
- If you deployed or updated the org's My Domain, logout from the CLI and authenticate again,
|
|
14
|
+
- If you are running in a CI environment with a DNS that blocks external IPs, try setting SFDX_DISABLE_DNS_CHECK=true
|
|
15
15
|
|
|
16
16
|
# noInstanceUrlError
|
|
17
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/core",
|
|
3
|
-
"version": "4.1
|
|
3
|
+
"version": "4.2.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",
|
|
@@ -41,33 +41,32 @@
|
|
|
41
41
|
"@salesforce/bunyan": "^2.0.0",
|
|
42
42
|
"@salesforce/kit": "^3.0.2",
|
|
43
43
|
"@salesforce/schemas": "^1.5.1",
|
|
44
|
-
"@salesforce/ts-types": "^2.0.
|
|
44
|
+
"@salesforce/ts-types": "^2.0.2",
|
|
45
45
|
"@types/semver": "^7.5.0",
|
|
46
46
|
"ajv": "^8.12.0",
|
|
47
|
-
"archiver": "^5.3.0",
|
|
48
47
|
"change-case": "^4.1.2",
|
|
49
48
|
"debug": "^3.2.7",
|
|
50
49
|
"faye": "^1.4.0",
|
|
51
50
|
"form-data": "^4.0.0",
|
|
52
51
|
"js2xmlparser": "^4.0.1",
|
|
53
|
-
"jsforce": "^2.0.0-beta.
|
|
52
|
+
"jsforce": "^2.0.0-beta.24",
|
|
54
53
|
"jsonwebtoken": "9.0.0",
|
|
54
|
+
"jszip": "3.10.1",
|
|
55
55
|
"proper-lockfile": "^4.1.2",
|
|
56
56
|
"ts-retry-promise": "^0.7.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@salesforce/dev-config": "^4.0.1",
|
|
60
|
-
"@salesforce/dev-scripts": "^5.
|
|
61
|
-
"@salesforce/prettier-config": "^0.0.
|
|
60
|
+
"@salesforce/dev-scripts": "^5.4.2",
|
|
61
|
+
"@salesforce/prettier-config": "^0.0.3",
|
|
62
62
|
"@salesforce/ts-sinon": "^1.4.6",
|
|
63
|
-
"@types/archiver": "^5.3.2",
|
|
64
63
|
"@types/chai-string": "^1.4.2",
|
|
65
64
|
"@types/debug": "0.0.31",
|
|
66
65
|
"@types/jsonwebtoken": "9.0.2",
|
|
67
|
-
"@types/lodash": "^4.14.
|
|
66
|
+
"@types/lodash": "^4.14.195",
|
|
68
67
|
"@types/proper-lockfile": "^4.1.2",
|
|
69
68
|
"@types/shelljs": "0.8.12",
|
|
70
|
-
"@typescript-eslint/eslint-plugin": "^5.59.
|
|
69
|
+
"@typescript-eslint/eslint-plugin": "^5.59.9",
|
|
71
70
|
"@typescript-eslint/parser": "^5.59.7",
|
|
72
71
|
"chai": "^4.3.7",
|
|
73
72
|
"chai-string": "^1.5.0",
|