@salesforce/core 6.0.1-crdt.0 → 6.1.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/README.md +3 -3
- package/lib/config/authInfoConfig.d.ts +1 -1
- package/lib/config/config.d.ts +6 -29
- package/lib/config/config.js +91 -113
- package/lib/config/configAggregator.js +1 -0
- package/lib/config/configFile.d.ts +3 -1
- package/lib/config/configFile.js +44 -67
- package/lib/config/configStore.d.ts +20 -29
- package/lib/config/configStore.js +50 -53
- package/lib/config/envVars.js +3 -2
- package/lib/config/lwwMap.d.ts +4 -5
- package/lib/config/lwwMap.js +19 -16
- package/lib/config/lwwRegister.d.ts +2 -3
- package/lib/config/lwwRegister.js +6 -7
- package/lib/config/sandboxOrgConfig.js +1 -1
- package/lib/config/sandboxProcessCache.d.ts +1 -1
- package/lib/crypto/crypto.js +4 -3
- package/lib/crypto/keyChain.js +1 -0
- package/lib/crypto/keyChainImpl.d.ts +2 -2
- package/lib/crypto/keyChainImpl.js +9 -8
- package/lib/crypto/secureBuffer.js +1 -1
- package/lib/deviceOauthService.d.ts +1 -1
- package/lib/deviceOauthService.js +8 -6
- package/lib/exported.d.ts +3 -4
- package/lib/exported.js +6 -6
- package/lib/global.js +4 -4
- package/lib/logger/logger.js +6 -5
- package/lib/logger/memoryLogger.d.ts +1 -1
- package/lib/logger/memoryLogger.js +2 -2
- package/lib/logger/transformStream.d.ts +1 -1
- package/lib/logger/transformStream.js +3 -3
- package/lib/messageTransformer.js +2 -2
- package/lib/messages.js +5 -5
- package/lib/org/authInfo.js +11 -10
- package/lib/org/authRemover.d.ts +1 -2
- package/lib/org/authRemover.js +2 -12
- package/lib/org/connection.js +3 -2
- package/lib/org/org.js +9 -8
- package/lib/org/orgConfigProperties.js +3 -2
- package/lib/org/permissionSetAssignment.js +15 -13
- package/lib/org/scratchOrgCreate.js +2 -1
- package/lib/org/scratchOrgErrorCodes.js +1 -0
- package/lib/org/scratchOrgFeatureDeprecation.js +1 -0
- package/lib/org/scratchOrgInfoApi.js +1 -0
- package/lib/org/scratchOrgInfoGenerator.js +3 -2
- package/lib/org/scratchOrgSettingsGenerator.js +3 -3
- package/lib/org/user.js +4 -3
- package/lib/schema/validator.js +2 -2
- package/lib/sfError.d.ts +1 -1
- package/lib/sfProject.d.ts +1 -0
- package/lib/sfProject.js +12 -11
- package/lib/stateAggregator/accessors/aliasAccessor.d.ts +1 -2
- package/lib/stateAggregator/accessors/aliasAccessor.js +3 -2
- package/lib/stateAggregator/accessors/orgAccessor.d.ts +2 -2
- package/lib/stateAggregator/accessors/orgAccessor.js +8 -6
- package/lib/stateAggregator/accessors/sandboxAccessor.d.ts +1 -1
- package/lib/stateAggregator/stateAggregator.d.ts +0 -2
- package/lib/stateAggregator/stateAggregator.js +0 -2
- package/lib/status/myDomainResolver.d.ts +1 -1
- package/lib/status/myDomainResolver.js +6 -6
- package/lib/status/pollingClient.js +1 -1
- package/lib/status/streamingClient.js +4 -3
- package/lib/status/types.d.ts +1 -1
- package/lib/status/types.js +2 -2
- package/lib/testSetup.d.ts +3 -7
- package/lib/testSetup.js +47 -39
- package/lib/util/cache.js +14 -14
- package/lib/util/checkLightningDomain.js +2 -2
- package/lib/util/directoryWriter.d.ts +1 -1
- package/lib/util/directoryWriter.js +7 -7
- package/lib/util/fileLocking.d.ts +24 -0
- package/lib/util/fileLocking.js +91 -0
- package/lib/util/findUppercaseKeys.d.ts +2 -0
- package/lib/util/findUppercaseKeys.js +29 -0
- package/lib/util/internal.js +7 -6
- package/lib/util/sfdc.d.ts +0 -18
- package/lib/util/sfdc.js +1 -42
- package/lib/util/sfdcUrl.d.ts +2 -2
- package/lib/util/sfdcUrl.js +9 -8
- package/lib/util/structuredWriter.d.ts +1 -1
- package/lib/util/time.d.ts +1 -0
- package/lib/util/time.js +13 -0
- package/lib/util/uniqid.js +3 -3
- package/lib/util/zipWriter.d.ts +1 -1
- package/lib/util/zipWriter.js +2 -2
- package/lib/webOAuthServer.d.ts +2 -2
- package/lib/webOAuthServer.js +16 -15
- package/package.json +14 -38
- package/lib/config/tokensConfig.d.ts +0 -10
- package/lib/config/tokensConfig.js +0 -29
- package/lib/org/index.d.ts +0 -6
- package/lib/org/index.js +0 -29
- package/lib/schema/printer.d.ts +0 -81
- package/lib/schema/printer.js +0 -263
- package/lib/stateAggregator/accessors/tokenAccessor.d.ts +0 -63
- package/lib/stateAggregator/accessors/tokenAccessor.js +0 -80
- package/lib/stateAggregator/index.d.ts +0 -4
- package/lib/stateAggregator/index.js +0 -27
- package/lib/util/jsonXmlTools.d.ts +0 -14
- package/lib/util/jsonXmlTools.js +0 -39
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/core",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"description": "Core libraries to interact with SFDX projects, orgs, and APIs.",
|
|
5
5
|
"main": "lib/exported",
|
|
6
6
|
"types": "lib/exported.d.ts",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"messageTransformer/messageTransformer.ts"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@salesforce/kit": "^3.0.
|
|
43
|
-
"@salesforce/schemas": "^1.6.
|
|
44
|
-
"@salesforce/ts-types": "^2.0.
|
|
45
|
-
"@types/semver": "^7.5.
|
|
42
|
+
"@salesforce/kit": "^3.0.15",
|
|
43
|
+
"@salesforce/schemas": "^1.6.1",
|
|
44
|
+
"@salesforce/ts-types": "^2.0.9",
|
|
45
|
+
"@types/semver": "^7.5.4",
|
|
46
46
|
"ajv": "^8.12.0",
|
|
47
47
|
"change-case": "^4.1.2",
|
|
48
48
|
"faye": "^1.4.0",
|
|
@@ -51,49 +51,25 @@
|
|
|
51
51
|
"jsforce": "^2.0.0-beta.28",
|
|
52
52
|
"jsonwebtoken": "9.0.2",
|
|
53
53
|
"jszip": "3.10.1",
|
|
54
|
-
"pino": "^8.
|
|
55
|
-
"pino-abstract-transport": "^1.
|
|
54
|
+
"pino": "^8.16.1",
|
|
55
|
+
"pino-abstract-transport": "^1.1.0",
|
|
56
56
|
"pino-pretty": "^10.2.3",
|
|
57
57
|
"proper-lockfile": "^4.1.2",
|
|
58
58
|
"semver": "^7.5.4",
|
|
59
59
|
"ts-retry-promise": "^0.7.1"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@salesforce/dev-
|
|
63
|
-
"@salesforce/
|
|
64
|
-
"@salesforce/prettier-config": "^0.0.3",
|
|
65
|
-
"@salesforce/ts-sinon": "^1.4.16",
|
|
62
|
+
"@salesforce/dev-scripts": "^6.0.3",
|
|
63
|
+
"@salesforce/ts-sinon": "^1.4.19",
|
|
66
64
|
"@types/benchmark": "^2.1.3",
|
|
67
|
-
"@types/chai-string": "^1.4.
|
|
65
|
+
"@types/chai-string": "^1.4.5",
|
|
68
66
|
"@types/jsonwebtoken": "9.0.3",
|
|
69
|
-
"@types/lodash": "^4.14.199",
|
|
70
67
|
"@types/proper-lockfile": "^4.1.2",
|
|
71
|
-
"@types/shelljs": "0.8.13",
|
|
72
|
-
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
73
|
-
"@typescript-eslint/parser": "^5.62.0",
|
|
74
68
|
"benchmark": "^2.1.4",
|
|
75
|
-
"chai": "^4.3.10",
|
|
76
69
|
"chai-string": "^1.5.0",
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"eslint-config-salesforce-license": "^0.2.0",
|
|
81
|
-
"eslint-config-salesforce-typescript": "^1.1.2",
|
|
82
|
-
"eslint-plugin-header": "^3.1.1",
|
|
83
|
-
"eslint-plugin-import": "^2.28.1",
|
|
84
|
-
"eslint-plugin-jsdoc": "^43.2.0",
|
|
85
|
-
"husky": "^7.0.4",
|
|
86
|
-
"lodash": "^4.17.21",
|
|
87
|
-
"mocha": "^9.1.3",
|
|
88
|
-
"nyc": "^15.1.0",
|
|
89
|
-
"prettier": "^2.8.7",
|
|
90
|
-
"pretty-quick": "^3.1.3",
|
|
91
|
-
"shelljs": "0.8.5",
|
|
92
|
-
"sinon": "^14.0.2",
|
|
93
|
-
"ts-node": "^10.4.0",
|
|
94
|
-
"ttypescript": "^1.5.15",
|
|
95
|
-
"typescript": "^4.9.5",
|
|
96
|
-
"wireit": "^0.14.0"
|
|
70
|
+
"ts-node": "^10.9.1",
|
|
71
|
+
"ts-patch": "^3.0.2",
|
|
72
|
+
"typescript": "^5.2.2"
|
|
97
73
|
},
|
|
98
74
|
"repository": {
|
|
99
75
|
"type": "git",
|
|
@@ -110,7 +86,7 @@
|
|
|
110
86
|
]
|
|
111
87
|
},
|
|
112
88
|
"compile": {
|
|
113
|
-
"command": "
|
|
89
|
+
"command": "tspc -p . --pretty --incremental",
|
|
114
90
|
"files": [
|
|
115
91
|
"src/**/*.ts",
|
|
116
92
|
"tsconfig.json",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Optional } from '@salesforce/ts-types';
|
|
2
|
-
import { SfTokens } from '../stateAggregator';
|
|
3
|
-
import { ConfigFile } from './configFile';
|
|
4
|
-
import { ConfigContents, ConfigValue } from './configStackTypes';
|
|
5
|
-
export declare class TokensConfig extends ConfigFile<ConfigFile.Options, SfTokens> {
|
|
6
|
-
protected static encryptedKeys: RegExp[];
|
|
7
|
-
static getDefaultOptions(): ConfigFile.Options;
|
|
8
|
-
protected getMethod(contents: ConfigContents, key: string): Optional<ConfigValue>;
|
|
9
|
-
protected setMethod(contents: ConfigContents, key: string, value?: ConfigValue): void;
|
|
10
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2022, salesforce.com, inc.
|
|
4
|
-
* All rights reserved.
|
|
5
|
-
* Licensed under the BSD 3-Clause license.
|
|
6
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
-
*/
|
|
8
|
-
/* eslint-disable class-methods-use-this */
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.TokensConfig = void 0;
|
|
11
|
-
const configFile_1 = require("./configFile");
|
|
12
|
-
class TokensConfig extends configFile_1.ConfigFile {
|
|
13
|
-
static getDefaultOptions() {
|
|
14
|
-
return {
|
|
15
|
-
isGlobal: true,
|
|
16
|
-
isState: true,
|
|
17
|
-
filename: 'tokens.json',
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
getMethod(contents, key) {
|
|
21
|
-
return contents[key];
|
|
22
|
-
}
|
|
23
|
-
setMethod(contents, key, value) {
|
|
24
|
-
contents[key] = value;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.TokensConfig = TokensConfig;
|
|
28
|
-
TokensConfig.encryptedKeys = [/token/i, /password/i, /secret/i];
|
|
29
|
-
//# sourceMappingURL=tokensConfig.js.map
|
package/lib/org/index.d.ts
DELETED
package/lib/org/index.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
4
|
-
* All rights reserved.
|
|
5
|
-
* Licensed under the BSD 3-Clause license.
|
|
6
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
-
*/
|
|
8
|
-
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
-
};
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
__exportStar(require("./authInfo"), exports);
|
|
24
|
-
__exportStar(require("./authRemover"), exports);
|
|
25
|
-
__exportStar(require("./connection"), exports);
|
|
26
|
-
__exportStar(require("./org"), exports);
|
|
27
|
-
__exportStar(require("./permissionSetAssignment"), exports);
|
|
28
|
-
__exportStar(require("./user"), exports);
|
|
29
|
-
//# sourceMappingURL=index.js.map
|
package/lib/schema/printer.d.ts
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { JsonMap } from '@salesforce/ts-types';
|
|
2
|
-
import { Logger } from '../logger/logger';
|
|
3
|
-
/**
|
|
4
|
-
* Renders schema properties. By default, this is simply an identity transform. Subclasses may provide more
|
|
5
|
-
* interesting decorations of each values, such as ANSI coloring.
|
|
6
|
-
*
|
|
7
|
-
* @deprecated
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
export declare class SchemaPropertyRenderer {
|
|
11
|
-
/**
|
|
12
|
-
* Renders a name.
|
|
13
|
-
*
|
|
14
|
-
* @param name The name value to render.
|
|
15
|
-
*/
|
|
16
|
-
renderName(name: string): string;
|
|
17
|
-
/**
|
|
18
|
-
* Renders a title.
|
|
19
|
-
*
|
|
20
|
-
* @param title The title value to render.
|
|
21
|
-
*/
|
|
22
|
-
renderTitle(title: string): string;
|
|
23
|
-
/**
|
|
24
|
-
* Renders a description.
|
|
25
|
-
*
|
|
26
|
-
* @param description The description value to render.
|
|
27
|
-
*/
|
|
28
|
-
renderDescription(description: string): string;
|
|
29
|
-
/**
|
|
30
|
-
* Renders a type.
|
|
31
|
-
*
|
|
32
|
-
* @param propertyType The type value to render.
|
|
33
|
-
*/
|
|
34
|
-
renderType(propertyType: string): string;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Prints a JSON schema in a human-friendly format.
|
|
38
|
-
*
|
|
39
|
-
* @deprecated
|
|
40
|
-
* remaining reference: https://github.com/salesforcecli/plugin-data/blob/cc1bdfa2c707f93a6da96beea8117b25f9612d4a/src/commands/data/import/tree.ts#L75
|
|
41
|
-
*
|
|
42
|
-
* ```
|
|
43
|
-
* import chalk from 'chalk';
|
|
44
|
-
* class MyPropertyRenderer extends SchemaPropertyRenderer {
|
|
45
|
-
* renderName(name) { return chalk.bold.blue(name); }
|
|
46
|
-
* }
|
|
47
|
-
*
|
|
48
|
-
* const printer = new SchemaPrinter(logger, schema, new MyPropertyRenderer());
|
|
49
|
-
* printer.getLines().forEach(console.log);
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
export declare class SchemaPrinter {
|
|
53
|
-
private schema;
|
|
54
|
-
private propertyRenderer;
|
|
55
|
-
private logger;
|
|
56
|
-
private lines;
|
|
57
|
-
/**
|
|
58
|
-
* Constructs a new `SchemaPrinter`.
|
|
59
|
-
*
|
|
60
|
-
* @param logger The logger to use when emitting the printed schema.
|
|
61
|
-
* @param schema The schema to print.
|
|
62
|
-
* @param propertyRenderer The property renderer.
|
|
63
|
-
*/
|
|
64
|
-
constructor(logger: Logger, schema: JsonMap, propertyRenderer?: SchemaPropertyRenderer);
|
|
65
|
-
/**
|
|
66
|
-
* Gets a read-only array of ready-to-display lines.
|
|
67
|
-
*/
|
|
68
|
-
getLines(): readonly string[];
|
|
69
|
-
/**
|
|
70
|
-
* Gets a ready-to-display line by index.
|
|
71
|
-
*
|
|
72
|
-
* @param index The line index to get.
|
|
73
|
-
*/
|
|
74
|
-
getLine(index: number): string;
|
|
75
|
-
/**
|
|
76
|
-
* Prints the accumulated set of schema lines as info log lines to the logger.
|
|
77
|
-
*/
|
|
78
|
-
print(): void;
|
|
79
|
-
private addFn;
|
|
80
|
-
private parseProperty;
|
|
81
|
-
}
|
package/lib/schema/printer.js
DELETED
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2020, salesforce.com, inc.
|
|
4
|
-
* All rights reserved.
|
|
5
|
-
* Licensed under the BSD 3-Clause license.
|
|
6
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
-
*/
|
|
8
|
-
/* eslint-disable class-methods-use-this */
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.SchemaPrinter = exports.SchemaPropertyRenderer = void 0;
|
|
11
|
-
const ts_types_1 = require("@salesforce/ts-types");
|
|
12
|
-
const sfError_1 = require("../sfError");
|
|
13
|
-
/**
|
|
14
|
-
* Renders schema properties. By default, this is simply an identity transform. Subclasses may provide more
|
|
15
|
-
* interesting decorations of each values, such as ANSI coloring.
|
|
16
|
-
*
|
|
17
|
-
* @deprecated
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
class SchemaPropertyRenderer {
|
|
21
|
-
/**
|
|
22
|
-
* Renders a name.
|
|
23
|
-
*
|
|
24
|
-
* @param name The name value to render.
|
|
25
|
-
*/
|
|
26
|
-
renderName(name) {
|
|
27
|
-
return name;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Renders a title.
|
|
31
|
-
*
|
|
32
|
-
* @param title The title value to render.
|
|
33
|
-
*/
|
|
34
|
-
renderTitle(title) {
|
|
35
|
-
return title;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Renders a description.
|
|
39
|
-
*
|
|
40
|
-
* @param description The description value to render.
|
|
41
|
-
*/
|
|
42
|
-
renderDescription(description) {
|
|
43
|
-
return description;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Renders a type.
|
|
47
|
-
*
|
|
48
|
-
* @param propertyType The type value to render.
|
|
49
|
-
*/
|
|
50
|
-
renderType(propertyType) {
|
|
51
|
-
return propertyType;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
exports.SchemaPropertyRenderer = SchemaPropertyRenderer;
|
|
55
|
-
/**
|
|
56
|
-
* Prints a JSON schema in a human-friendly format.
|
|
57
|
-
*
|
|
58
|
-
* @deprecated
|
|
59
|
-
* remaining reference: https://github.com/salesforcecli/plugin-data/blob/cc1bdfa2c707f93a6da96beea8117b25f9612d4a/src/commands/data/import/tree.ts#L75
|
|
60
|
-
*
|
|
61
|
-
* ```
|
|
62
|
-
* import chalk from 'chalk';
|
|
63
|
-
* class MyPropertyRenderer extends SchemaPropertyRenderer {
|
|
64
|
-
* renderName(name) { return chalk.bold.blue(name); }
|
|
65
|
-
* }
|
|
66
|
-
*
|
|
67
|
-
* const printer = new SchemaPrinter(logger, schema, new MyPropertyRenderer());
|
|
68
|
-
* printer.getLines().forEach(console.log);
|
|
69
|
-
* ```
|
|
70
|
-
*/
|
|
71
|
-
class SchemaPrinter {
|
|
72
|
-
/**
|
|
73
|
-
* Constructs a new `SchemaPrinter`.
|
|
74
|
-
*
|
|
75
|
-
* @param logger The logger to use when emitting the printed schema.
|
|
76
|
-
* @param schema The schema to print.
|
|
77
|
-
* @param propertyRenderer The property renderer.
|
|
78
|
-
*/
|
|
79
|
-
constructor(logger, schema, propertyRenderer = new SchemaPropertyRenderer()) {
|
|
80
|
-
this.schema = schema;
|
|
81
|
-
this.propertyRenderer = propertyRenderer;
|
|
82
|
-
this.lines = [];
|
|
83
|
-
this.logger = logger.child('SchemaPrinter');
|
|
84
|
-
if (!this.schema.properties && !this.schema.items) {
|
|
85
|
-
// No need to add to messages, since this should never happen. In fact,
|
|
86
|
-
// this will cause a test failure if there is a command that uses a schema
|
|
87
|
-
// with no properties defined.
|
|
88
|
-
throw new sfError_1.SfError('There is no purpose to print a schema with no properties or items');
|
|
89
|
-
}
|
|
90
|
-
const startLevel = 0;
|
|
91
|
-
const add = this.addFn(startLevel);
|
|
92
|
-
// For object schemas, print out the "header" and first level properties differently
|
|
93
|
-
if (this.schema.properties) {
|
|
94
|
-
if (typeof this.schema.description === 'string') {
|
|
95
|
-
// Output the overall schema description before printing the properties
|
|
96
|
-
add(this.schema.description);
|
|
97
|
-
add('');
|
|
98
|
-
}
|
|
99
|
-
Object.keys(this.schema.properties).forEach((key) => {
|
|
100
|
-
const properties = (0, ts_types_1.asJsonMap)(this.schema.properties);
|
|
101
|
-
if (!properties) {
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
this.parseProperty(key, (0, ts_types_1.asJsonMap)(properties[key]), startLevel);
|
|
105
|
-
add('');
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
this.parseProperty('schema', this.schema, startLevel);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Gets a read-only array of ready-to-display lines.
|
|
114
|
-
*/
|
|
115
|
-
getLines() {
|
|
116
|
-
return this.lines;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Gets a ready-to-display line by index.
|
|
120
|
-
*
|
|
121
|
-
* @param index The line index to get.
|
|
122
|
-
*/
|
|
123
|
-
getLine(index) {
|
|
124
|
-
return this.lines[index];
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Prints the accumulated set of schema lines as info log lines to the logger.
|
|
128
|
-
*/
|
|
129
|
-
print() {
|
|
130
|
-
this.lines.forEach((line) => this.logger.info(line));
|
|
131
|
-
}
|
|
132
|
-
addFn(level) {
|
|
133
|
-
const indent = ' '.repeat(level * 4);
|
|
134
|
-
return (line) => {
|
|
135
|
-
this.lines.push(`${indent}${line}`);
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
parseProperty(name, rawProperty, level = 0) {
|
|
139
|
-
if (!rawProperty) {
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
const add = this.addFn(level);
|
|
143
|
-
const property = new SchemaProperty(this.logger, this.schema, name, rawProperty, this.propertyRenderer);
|
|
144
|
-
add(property.renderHeader());
|
|
145
|
-
if (property.type === 'object' && property.properties) {
|
|
146
|
-
Object.keys(property.properties).forEach((key) => {
|
|
147
|
-
this.parseProperty(key, property.getProperty(key), level + 1);
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
if (property.type === 'array') {
|
|
151
|
-
add(` ${property.renderArrayHeader()}`);
|
|
152
|
-
if (property.items && property.items.type === 'object' && property.items.properties) {
|
|
153
|
-
Object.keys(property.items.properties).forEach((key) => {
|
|
154
|
-
const items = (0, ts_types_1.asJsonMap)(property.items);
|
|
155
|
-
if (!items) {
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
const properties = (0, ts_types_1.asJsonMap)(items.properties);
|
|
159
|
-
if (!properties) {
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
this.parseProperty(key, (0, ts_types_1.asJsonMap)(properties[key]), level + 2);
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
if (property.required) {
|
|
167
|
-
add(`Required: ${property.required.join(', ')}`);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
exports.SchemaPrinter = SchemaPrinter;
|
|
172
|
-
class SchemaProperty {
|
|
173
|
-
constructor(logger, schema, name, rawProperty, propertyRenderer) {
|
|
174
|
-
this.logger = logger;
|
|
175
|
-
this.schema = schema;
|
|
176
|
-
this.name = name;
|
|
177
|
-
this.rawProperty = rawProperty;
|
|
178
|
-
this.propertyRenderer = propertyRenderer;
|
|
179
|
-
this.name = name;
|
|
180
|
-
// Capture the referenced definition, if specified
|
|
181
|
-
if (typeof this.rawProperty.$ref === 'string') {
|
|
182
|
-
// Copy the referenced property while adding the original property's properties on top of that --
|
|
183
|
-
// if they are defined here, they take precedence over referenced definition properties.
|
|
184
|
-
this.rawProperty = Object.assign({}, resolveRef(this.schema, this.rawProperty), rawProperty);
|
|
185
|
-
}
|
|
186
|
-
const oneOfs = (0, ts_types_1.asJsonArray)(this.rawProperty.oneOf);
|
|
187
|
-
if (oneOfs && !this.rawProperty.type) {
|
|
188
|
-
this.rawProperty.type = oneOfs.map((value) => ((0, ts_types_1.isJsonMap)(value) ? value.type ?? value.$ref : value)).join('|');
|
|
189
|
-
}
|
|
190
|
-
// Handle items references
|
|
191
|
-
if ((0, ts_types_1.isJsonMap)(this.items) && this.items && this.items.$ref) {
|
|
192
|
-
Object.assign(this.items, resolveRef(this.schema, this.items));
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
get title() {
|
|
196
|
-
return (0, ts_types_1.asString)(this.rawProperty.title);
|
|
197
|
-
}
|
|
198
|
-
get description() {
|
|
199
|
-
return (0, ts_types_1.asString)(this.rawProperty.description);
|
|
200
|
-
}
|
|
201
|
-
get type() {
|
|
202
|
-
return (0, ts_types_1.asString)(this.rawProperty.type);
|
|
203
|
-
}
|
|
204
|
-
get required() {
|
|
205
|
-
return (0, ts_types_1.asJsonArray)(this.rawProperty.required);
|
|
206
|
-
}
|
|
207
|
-
get properties() {
|
|
208
|
-
return (0, ts_types_1.asJsonMap)(this.rawProperty.properties);
|
|
209
|
-
}
|
|
210
|
-
get items() {
|
|
211
|
-
return (0, ts_types_1.asJsonMap)(this.rawProperty.items);
|
|
212
|
-
}
|
|
213
|
-
get minItems() {
|
|
214
|
-
return (0, ts_types_1.asNumber)(this.rawProperty.minItems);
|
|
215
|
-
}
|
|
216
|
-
getProperty(key) {
|
|
217
|
-
const properties = this.getProperties();
|
|
218
|
-
return (0, ts_types_1.asJsonMap)(properties?.[key]);
|
|
219
|
-
}
|
|
220
|
-
getProperties() {
|
|
221
|
-
return (0, ts_types_1.asJsonMap)(this.rawProperty.properties);
|
|
222
|
-
}
|
|
223
|
-
renderName() {
|
|
224
|
-
return this.propertyRenderer.renderName(this.name);
|
|
225
|
-
}
|
|
226
|
-
renderTitle() {
|
|
227
|
-
return this.propertyRenderer.renderTitle(this.title ?? '');
|
|
228
|
-
}
|
|
229
|
-
renderDescription() {
|
|
230
|
-
return this.propertyRenderer.renderDescription(this.description ?? '');
|
|
231
|
-
}
|
|
232
|
-
renderType() {
|
|
233
|
-
return this.propertyRenderer.renderType(this.type ?? '');
|
|
234
|
-
}
|
|
235
|
-
renderHeader() {
|
|
236
|
-
return `${this.renderName()}(${this.renderType()}) - ${this.renderTitle()}: ${this.renderDescription()}`;
|
|
237
|
-
}
|
|
238
|
-
renderArrayHeader() {
|
|
239
|
-
if (!this.items) {
|
|
240
|
-
return '';
|
|
241
|
-
}
|
|
242
|
-
const minItems = this.minItems ? ` - min ${this.minItems}` : '';
|
|
243
|
-
const prop = new SchemaProperty(this.logger, this.schema, 'items', this.items, this.propertyRenderer);
|
|
244
|
-
return `items(${prop.renderType()}${minItems}) - ${prop.renderTitle()}: ${prop.renderDescription()}`;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Get the referenced definition by following the reference path on the current schema.
|
|
249
|
-
*
|
|
250
|
-
* @param schema The source schema containing the property containing a `$ref` field.
|
|
251
|
-
* @param property The property that contains the `$ref` field.
|
|
252
|
-
*/
|
|
253
|
-
function resolveRef(schema, property) {
|
|
254
|
-
const ref = property.$ref;
|
|
255
|
-
if (!ref || typeof ref !== 'string') {
|
|
256
|
-
return null;
|
|
257
|
-
}
|
|
258
|
-
return ref.split('/').reduce((prev, key) => {
|
|
259
|
-
const next = prev[key];
|
|
260
|
-
return key === '#' ? schema : (0, ts_types_1.isJsonMap)(next) ? next : {};
|
|
261
|
-
}, property);
|
|
262
|
-
}
|
|
263
|
-
//# sourceMappingURL=printer.js.map
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { AsyncOptionalCreatable } from '@salesforce/kit';
|
|
2
|
-
import { JsonMap, Optional } from '@salesforce/ts-types';
|
|
3
|
-
export type SfToken = {
|
|
4
|
-
token: string;
|
|
5
|
-
url: string;
|
|
6
|
-
user?: string;
|
|
7
|
-
timestamp: string;
|
|
8
|
-
} & JsonMap;
|
|
9
|
-
export type SfTokens = {
|
|
10
|
-
[key: string]: SfToken;
|
|
11
|
-
};
|
|
12
|
-
export declare class TokenAccessor extends AsyncOptionalCreatable {
|
|
13
|
-
private config;
|
|
14
|
-
/**
|
|
15
|
-
* Return all tokens.
|
|
16
|
-
*
|
|
17
|
-
* @param decrypt
|
|
18
|
-
* @returns {SfTokens}
|
|
19
|
-
*/
|
|
20
|
-
getAll(decrypt?: boolean): SfTokens;
|
|
21
|
-
/**
|
|
22
|
-
* Return a token for the provided name.
|
|
23
|
-
*
|
|
24
|
-
* @param name
|
|
25
|
-
* @param decrypt
|
|
26
|
-
* @returns {Optional<SfToken>}
|
|
27
|
-
*/
|
|
28
|
-
get(name: string, decrypt?: boolean): Optional<SfToken>;
|
|
29
|
-
/**
|
|
30
|
-
* Return true if a given name has a token associated with it.
|
|
31
|
-
*
|
|
32
|
-
* @param name
|
|
33
|
-
* @returns {boolean}
|
|
34
|
-
*/
|
|
35
|
-
has(name: string): boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Set the token for the provided name.
|
|
38
|
-
*
|
|
39
|
-
* @param name
|
|
40
|
-
* @param token
|
|
41
|
-
*/
|
|
42
|
-
set(name: string, token: Partial<SfToken>): void;
|
|
43
|
-
/**
|
|
44
|
-
* Update the token for the provided name.
|
|
45
|
-
*
|
|
46
|
-
* @param name
|
|
47
|
-
* @param token
|
|
48
|
-
*/
|
|
49
|
-
update(name: string, token: Partial<SfToken>): void;
|
|
50
|
-
/**
|
|
51
|
-
* Unset the token for the provided name.
|
|
52
|
-
*
|
|
53
|
-
* @param name
|
|
54
|
-
*/
|
|
55
|
-
unset(name: string): void;
|
|
56
|
-
/**
|
|
57
|
-
* Write the contents to the token file.
|
|
58
|
-
*
|
|
59
|
-
* @returns {Promise<SfTokens>}
|
|
60
|
-
*/
|
|
61
|
-
write(): Promise<SfTokens>;
|
|
62
|
-
protected init(): Promise<void>;
|
|
63
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2021, salesforce.com, inc.
|
|
4
|
-
* All rights reserved.
|
|
5
|
-
* Licensed under the BSD 3-Clause license.
|
|
6
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.TokenAccessor = void 0;
|
|
10
|
-
const kit_1 = require("@salesforce/kit");
|
|
11
|
-
const tokensConfig_1 = require("../../config/tokensConfig");
|
|
12
|
-
class TokenAccessor extends kit_1.AsyncOptionalCreatable {
|
|
13
|
-
/**
|
|
14
|
-
* Return all tokens.
|
|
15
|
-
*
|
|
16
|
-
* @param decrypt
|
|
17
|
-
* @returns {SfTokens}
|
|
18
|
-
*/
|
|
19
|
-
getAll(decrypt = false) {
|
|
20
|
-
return this.config.getContents(decrypt) || {};
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Return a token for the provided name.
|
|
24
|
-
*
|
|
25
|
-
* @param name
|
|
26
|
-
* @param decrypt
|
|
27
|
-
* @returns {Optional<SfToken>}
|
|
28
|
-
*/
|
|
29
|
-
get(name, decrypt = false) {
|
|
30
|
-
return this.config.get(name, decrypt);
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Return true if a given name has a token associated with it.
|
|
34
|
-
*
|
|
35
|
-
* @param name
|
|
36
|
-
* @returns {boolean}
|
|
37
|
-
*/
|
|
38
|
-
has(name) {
|
|
39
|
-
return !!this.getAll()[name];
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Set the token for the provided name.
|
|
43
|
-
*
|
|
44
|
-
* @param name
|
|
45
|
-
* @param token
|
|
46
|
-
*/
|
|
47
|
-
set(name, token) {
|
|
48
|
-
this.config.set(name, token);
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Update the token for the provided name.
|
|
52
|
-
*
|
|
53
|
-
* @param name
|
|
54
|
-
* @param token
|
|
55
|
-
*/
|
|
56
|
-
update(name, token) {
|
|
57
|
-
this.config.update(name, token);
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Unset the token for the provided name.
|
|
61
|
-
*
|
|
62
|
-
* @param name
|
|
63
|
-
*/
|
|
64
|
-
unset(name) {
|
|
65
|
-
this.config.unset(name);
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Write the contents to the token file.
|
|
69
|
-
*
|
|
70
|
-
* @returns {Promise<SfTokens>}
|
|
71
|
-
*/
|
|
72
|
-
async write() {
|
|
73
|
-
return this.config.write();
|
|
74
|
-
}
|
|
75
|
-
async init() {
|
|
76
|
-
this.config = await tokensConfig_1.TokensConfig.create();
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
exports.TokenAccessor = TokenAccessor;
|
|
80
|
-
//# sourceMappingURL=tokenAccessor.js.map
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright (c) 2021, salesforce.com, inc.
|
|
4
|
-
* All rights reserved.
|
|
5
|
-
* Licensed under the BSD 3-Clause license.
|
|
6
|
-
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
-
*/
|
|
8
|
-
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
20
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
-
};
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
__exportStar(require("./accessors/orgAccessor"), exports);
|
|
24
|
-
__exportStar(require("./accessors/aliasAccessor"), exports);
|
|
25
|
-
__exportStar(require("./accessors/tokenAccessor"), exports);
|
|
26
|
-
__exportStar(require("./stateAggregator"), exports);
|
|
27
|
-
//# sourceMappingURL=index.js.map
|