sfdx-browserforce-plugin 5.0.1 → 5.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/package.json +2 -5
- package/lib/browserforce-command.d.ts +0 -15
- package/lib/browserforce-command.js +0 -61
- package/lib/browserforce-command.js.map +0 -1
- package/lib/browserforce.d.ts +0 -25
- package/lib/browserforce.js +0 -169
- package/lib/browserforce.js.map +0 -1
- package/lib/commands/browserforce/apply.d.ts +0 -10
- package/lib/commands/browserforce/apply.js +0 -54
- package/lib/commands/browserforce/apply.js.map +0 -1
- package/lib/commands/browserforce/plan.d.ts +0 -10
- package/lib/commands/browserforce/plan.js +0 -56
- package/lib/commands/browserforce/plan.js.map +0 -1
- package/lib/config-parser.d.ts +0 -16
- package/lib/config-parser.js +0 -24
- package/lib/config-parser.js.map +0 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -2
- package/lib/index.js.map +0 -1
- package/lib/jsforce-utils.d.ts +0 -5
- package/lib/jsforce-utils.js +0 -14
- package/lib/jsforce-utils.js.map +0 -1
- package/lib/pages/login.d.ts +0 -8
- package/lib/pages/login.js +0 -39
- package/lib/pages/login.js.map +0 -1
- package/lib/plugin.d.ts +0 -17
- package/lib/plugin.js +0 -30
- package/lib/plugin.js.map +0 -1
- package/lib/plugins/activity-settings/index.d.ts +0 -9
- package/lib/plugins/activity-settings/index.e2e-spec.d.ts +0 -1
- package/lib/plugins/activity-settings/index.e2e-spec.js +0 -36
- package/lib/plugins/activity-settings/index.e2e-spec.js.map +0 -1
- package/lib/plugins/activity-settings/index.js +0 -31
- package/lib/plugins/activity-settings/index.js.map +0 -1
- package/lib/plugins/company-information/index.d.ts +0 -8
- package/lib/plugins/company-information/index.e2e-spec.d.ts +0 -1
- package/lib/plugins/company-information/index.e2e-spec.js +0 -37
- package/lib/plugins/company-information/index.e2e-spec.js.map +0 -1
- package/lib/plugins/company-information/index.js +0 -50
- package/lib/plugins/company-information/index.js.map +0 -1
- package/lib/plugins/customer-portal/available-custom-objects/index.d.ts +0 -14
- package/lib/plugins/customer-portal/available-custom-objects/index.js +0 -114
- package/lib/plugins/customer-portal/available-custom-objects/index.js.map +0 -1
- package/lib/plugins/customer-portal/available-custom-objects/index.test.d.ts +0 -1
- package/lib/plugins/customer-portal/available-custom-objects/index.test.js +0 -39
- package/lib/plugins/customer-portal/available-custom-objects/index.test.js.map +0 -1
- package/lib/plugins/customer-portal/enabled/index.d.ts +0 -6
- package/lib/plugins/customer-portal/enabled/index.js +0 -27
- package/lib/plugins/customer-portal/enabled/index.js.map +0 -1
- package/lib/plugins/customer-portal/enabled/index.test.d.ts +0 -1
- package/lib/plugins/customer-portal/enabled/index.test.js +0 -34
- package/lib/plugins/customer-portal/enabled/index.test.js.map +0 -1
- package/lib/plugins/customer-portal/index.d.ts +0 -15
- package/lib/plugins/customer-portal/index.e2e-spec.d.ts +0 -1
- package/lib/plugins/customer-portal/index.e2e-spec.js +0 -202
- package/lib/plugins/customer-portal/index.e2e-spec.js.map +0 -1
- package/lib/plugins/customer-portal/index.js +0 -59
- package/lib/plugins/customer-portal/index.js.map +0 -1
- package/lib/plugins/customer-portal/index.test.d.ts +0 -1
- package/lib/plugins/customer-portal/index.test.js +0 -84
- package/lib/plugins/customer-portal/index.test.js.map +0 -1
- package/lib/plugins/customer-portal/portals/index.d.ts +0 -25
- package/lib/plugins/customer-portal/portals/index.js +0 -180
- package/lib/plugins/customer-portal/portals/index.js.map +0 -1
- package/lib/plugins/customer-portal/portals/index.test.d.ts +0 -1
- package/lib/plugins/customer-portal/portals/index.test.js +0 -140
- package/lib/plugins/customer-portal/portals/index.test.js.map +0 -1
- package/lib/plugins/density-settings/index.d.ts +0 -17
- package/lib/plugins/density-settings/index.e2e-spec.d.ts +0 -1
- package/lib/plugins/density-settings/index.e2e-spec.js +0 -39
- package/lib/plugins/density-settings/index.e2e-spec.js.map +0 -1
- package/lib/plugins/density-settings/index.js +0 -46
- package/lib/plugins/density-settings/index.js.map +0 -1
- package/lib/plugins/deprecated.d.ts +0 -4
- package/lib/plugins/deprecated.js +0 -28
- package/lib/plugins/deprecated.js.map +0 -1
- package/lib/plugins/email-deliverability/index.d.ts +0 -9
- package/lib/plugins/email-deliverability/index.e2e-spec.d.ts +0 -1
- package/lib/plugins/email-deliverability/index.e2e-spec.js +0 -55
- package/lib/plugins/email-deliverability/index.e2e-spec.js.map +0 -1
- package/lib/plugins/email-deliverability/index.js +0 -39
- package/lib/plugins/email-deliverability/index.js.map +0 -1
- package/lib/plugins/high-velocity-sales-settings/index.d.ts +0 -10
- package/lib/plugins/high-velocity-sales-settings/index.e2e-spec.d.ts +0 -1
- package/lib/plugins/high-velocity-sales-settings/index.e2e-spec.js +0 -29
- package/lib/plugins/high-velocity-sales-settings/index.e2e-spec.js.map +0 -1
- package/lib/plugins/high-velocity-sales-settings/index.js +0 -42
- package/lib/plugins/high-velocity-sales-settings/index.js.map +0 -1
- package/lib/plugins/high-velocity-sales-settings/page.d.ts +0 -7
- package/lib/plugins/high-velocity-sales-settings/page.js +0 -29
- package/lib/plugins/high-velocity-sales-settings/page.js.map +0 -1
- package/lib/plugins/history-tracking/index.d.ts +0 -17
- package/lib/plugins/history-tracking/index.e2e-spec.d.ts +0 -1
- package/lib/plugins/history-tracking/index.e2e-spec.js +0 -106
- package/lib/plugins/history-tracking/index.e2e-spec.js.map +0 -1
- package/lib/plugins/history-tracking/index.js +0 -169
- package/lib/plugins/history-tracking/index.js.map +0 -1
- package/lib/plugins/home-page-layouts/index.d.ts +0 -14
- package/lib/plugins/home-page-layouts/index.e2e-spec.d.ts +0 -1
- package/lib/plugins/home-page-layouts/index.e2e-spec.js +0 -47
- package/lib/plugins/home-page-layouts/index.e2e-spec.js.map +0 -1
- package/lib/plugins/home-page-layouts/index.js +0 -90
- package/lib/plugins/home-page-layouts/index.js.map +0 -1
- package/lib/plugins/home-page-layouts/index.test.d.ts +0 -1
- package/lib/plugins/home-page-layouts/index.test.js +0 -104
- package/lib/plugins/home-page-layouts/index.test.js.map +0 -1
- package/lib/plugins/index.d.ts +0 -23
- package/lib/plugins/index.js +0 -24
- package/lib/plugins/index.js.map +0 -1
- package/lib/plugins/lightning-experience-settings/index.d.ts +0 -17
- package/lib/plugins/lightning-experience-settings/index.e2e-spec.d.ts +0 -1
- package/lib/plugins/lightning-experience-settings/index.e2e-spec.js +0 -39
- package/lib/plugins/lightning-experience-settings/index.e2e-spec.js.map +0 -1
- package/lib/plugins/lightning-experience-settings/index.js +0 -61
- package/lib/plugins/lightning-experience-settings/index.js.map +0 -1
- package/lib/plugins/linkedin-sales-navigator-settings/index.d.ts +0 -8
- package/lib/plugins/linkedin-sales-navigator-settings/index.e2e-spec.d.ts +0 -1
- package/lib/plugins/linkedin-sales-navigator-settings/index.e2e-spec.js +0 -29
- package/lib/plugins/linkedin-sales-navigator-settings/index.e2e-spec.js.map +0 -1
- package/lib/plugins/linkedin-sales-navigator-settings/index.js +0 -15
- package/lib/plugins/linkedin-sales-navigator-settings/index.js.map +0 -1
- package/lib/plugins/linkedin-sales-navigator-settings/page.d.ts +0 -8
- package/lib/plugins/linkedin-sales-navigator-settings/page.js +0 -32
- package/lib/plugins/linkedin-sales-navigator-settings/page.js.map +0 -1
- package/lib/plugins/omni-channel-settings/index.d.ts +0 -9
- package/lib/plugins/omni-channel-settings/index.e2e-spec.d.ts +0 -1
- package/lib/plugins/omni-channel-settings/index.e2e-spec.js +0 -26
- package/lib/plugins/omni-channel-settings/index.e2e-spec.js.map +0 -1
- package/lib/plugins/omni-channel-settings/index.js +0 -29
- package/lib/plugins/omni-channel-settings/index.js.map +0 -1
- package/lib/plugins/opportunity-splits/index.d.ts +0 -9
- package/lib/plugins/opportunity-splits/index.e2e-spec.d.ts +0 -1
- package/lib/plugins/opportunity-splits/index.e2e-spec.js +0 -46
- package/lib/plugins/opportunity-splits/index.e2e-spec.js.map +0 -1
- package/lib/plugins/opportunity-splits/index.js +0 -32
- package/lib/plugins/opportunity-splits/index.js.map +0 -1
- package/lib/plugins/opportunity-splits/pages/layout-selection.d.ts +0 -8
- package/lib/plugins/opportunity-splits/pages/layout-selection.js +0 -17
- package/lib/plugins/opportunity-splits/pages/layout-selection.js.map +0 -1
- package/lib/plugins/opportunity-splits/pages/overview.d.ts +0 -10
- package/lib/plugins/opportunity-splits/pages/overview.js +0 -38
- package/lib/plugins/opportunity-splits/pages/overview.js.map +0 -1
- package/lib/plugins/opportunity-splits/pages/setup.d.ts +0 -8
- package/lib/plugins/opportunity-splits/pages/setup.js +0 -19
- package/lib/plugins/opportunity-splits/pages/setup.js.map +0 -1
- package/lib/plugins/permission-sets/index.d.ts +0 -10
- package/lib/plugins/permission-sets/index.e2e-spec.d.ts +0 -1
- package/lib/plugins/permission-sets/index.e2e-spec.js +0 -36
- package/lib/plugins/permission-sets/index.e2e-spec.js.map +0 -1
- package/lib/plugins/permission-sets/index.js +0 -22
- package/lib/plugins/permission-sets/index.js.map +0 -1
- package/lib/plugins/permission-sets/service-presence-status/index.d.ts +0 -10
- package/lib/plugins/permission-sets/service-presence-status/index.js +0 -60
- package/lib/plugins/permission-sets/service-presence-status/index.js.map +0 -1
- package/lib/plugins/picklists/field-dependencies/index.d.ts +0 -11
- package/lib/plugins/picklists/field-dependencies/index.js +0 -56
- package/lib/plugins/picklists/field-dependencies/index.js.map +0 -1
- package/lib/plugins/picklists/field-dependencies/index.test.d.ts +0 -1
- package/lib/plugins/picklists/field-dependencies/index.test.js +0 -64
- package/lib/plugins/picklists/field-dependencies/index.test.js.map +0 -1
- package/lib/plugins/picklists/field-dependencies/pages.d.ts +0 -14
- package/lib/plugins/picklists/field-dependencies/pages.js +0 -57
- package/lib/plugins/picklists/field-dependencies/pages.js.map +0 -1
- package/lib/plugins/picklists/index.d.ts +0 -23
- package/lib/plugins/picklists/index.e2e-spec.d.ts +0 -1
- package/lib/plugins/picklists/index.e2e-spec.js +0 -100
- package/lib/plugins/picklists/index.e2e-spec.js.map +0 -1
- package/lib/plugins/picklists/index.js +0 -153
- package/lib/plugins/picklists/index.js.map +0 -1
- package/lib/plugins/picklists/pages.d.ts +0 -40
- package/lib/plugins/picklists/pages.js +0 -194
- package/lib/plugins/picklists/pages.js.map +0 -1
- package/lib/plugins/picklists/standard-value-set.d.ts +0 -1
- package/lib/plugins/picklists/standard-value-set.js +0 -80
- package/lib/plugins/picklists/standard-value-set.js.map +0 -1
- package/lib/plugins/record-types/index.d.ts +0 -13
- package/lib/plugins/record-types/index.e2e-spec.d.ts +0 -1
- package/lib/plugins/record-types/index.e2e-spec.js +0 -73
- package/lib/plugins/record-types/index.e2e-spec.js.map +0 -1
- package/lib/plugins/record-types/index.js +0 -70
- package/lib/plugins/record-types/index.js.map +0 -1
- package/lib/plugins/record-types/pages.d.ts +0 -15
- package/lib/plugins/record-types/pages.js +0 -64
- package/lib/plugins/record-types/pages.js.map +0 -1
- package/lib/plugins/relate-contact-to-multiple-accounts/index.d.ts +0 -11
- package/lib/plugins/relate-contact-to-multiple-accounts/index.e2e-spec.d.ts +0 -1
- package/lib/plugins/relate-contact-to-multiple-accounts/index.e2e-spec.js +0 -29
- package/lib/plugins/relate-contact-to-multiple-accounts/index.e2e-spec.js.map +0 -1
- package/lib/plugins/relate-contact-to-multiple-accounts/index.js +0 -72
- package/lib/plugins/relate-contact-to-multiple-accounts/index.js.map +0 -1
- package/lib/plugins/reports-and-dashboards/folder-sharing/index.d.ts +0 -8
- package/lib/plugins/reports-and-dashboards/folder-sharing/index.e2e-spec.d.ts +0 -1
- package/lib/plugins/reports-and-dashboards/folder-sharing/index.e2e-spec.js +0 -3
- package/lib/plugins/reports-and-dashboards/folder-sharing/index.e2e-spec.js.map +0 -1
- package/lib/plugins/reports-and-dashboards/folder-sharing/index.js +0 -50
- package/lib/plugins/reports-and-dashboards/folder-sharing/index.js.map +0 -1
- package/lib/plugins/reports-and-dashboards/index.d.ts +0 -11
- package/lib/plugins/reports-and-dashboards/index.e2e-spec.d.ts +0 -1
- package/lib/plugins/reports-and-dashboards/index.e2e-spec.js +0 -3
- package/lib/plugins/reports-and-dashboards/index.e2e-spec.js.map +0 -1
- package/lib/plugins/reports-and-dashboards/index.js +0 -29
- package/lib/plugins/reports-and-dashboards/index.js.map +0 -1
- package/lib/plugins/salesforce-cpq-config/formConfig.d.ts +0 -17
- package/lib/plugins/salesforce-cpq-config/formConfig.js +0 -649
- package/lib/plugins/salesforce-cpq-config/formConfig.js.map +0 -1
- package/lib/plugins/salesforce-cpq-config/index.d.ts +0 -7
- package/lib/plugins/salesforce-cpq-config/index.e2e-spec.d.ts +0 -1
- package/lib/plugins/salesforce-cpq-config/index.e2e-spec.js +0 -37
- package/lib/plugins/salesforce-cpq-config/index.e2e-spec.js.map +0 -1
- package/lib/plugins/salesforce-cpq-config/index.js +0 -195
- package/lib/plugins/salesforce-cpq-config/index.js.map +0 -1
- package/lib/plugins/salesforce-to-salesforce/index.d.ts +0 -9
- package/lib/plugins/salesforce-to-salesforce/index.e2e-spec.d.ts +0 -1
- package/lib/plugins/salesforce-to-salesforce/index.e2e-spec.js +0 -34
- package/lib/plugins/salesforce-to-salesforce/index.e2e-spec.js.map +0 -1
- package/lib/plugins/salesforce-to-salesforce/index.js +0 -44
- package/lib/plugins/salesforce-to-salesforce/index.js.map +0 -1
- package/lib/plugins/security/authentication-configuration/index.d.ts +0 -11
- package/lib/plugins/security/authentication-configuration/index.e2e-spec.d.ts +0 -1
- package/lib/plugins/security/authentication-configuration/index.e2e-spec.js +0 -101
- package/lib/plugins/security/authentication-configuration/index.e2e-spec.js.map +0 -1
- package/lib/plugins/security/authentication-configuration/index.js +0 -62
- package/lib/plugins/security/authentication-configuration/index.js.map +0 -1
- package/lib/plugins/security/certificate-and-key-management/index.d.ts +0 -23
- package/lib/plugins/security/certificate-and-key-management/index.e2e-spec.d.ts +0 -1
- package/lib/plugins/security/certificate-and-key-management/index.e2e-spec.js +0 -63
- package/lib/plugins/security/certificate-and-key-management/index.e2e-spec.js.map +0 -1
- package/lib/plugins/security/certificate-and-key-management/index.js +0 -159
- package/lib/plugins/security/certificate-and-key-management/index.js.map +0 -1
- package/lib/plugins/security/certificate-and-key-management/index.test.d.ts +0 -1
- package/lib/plugins/security/certificate-and-key-management/index.test.js +0 -61
- package/lib/plugins/security/certificate-and-key-management/index.test.js.map +0 -1
- package/lib/plugins/security/index.d.ts +0 -13
- package/lib/plugins/security/index.js +0 -42
- package/lib/plugins/security/index.js.map +0 -1
- package/lib/plugins/service-channels/capacity/index.d.ts +0 -18
- package/lib/plugins/service-channels/capacity/index.js +0 -133
- package/lib/plugins/service-channels/capacity/index.js.map +0 -1
- package/lib/plugins/service-channels/index.d.ts +0 -12
- package/lib/plugins/service-channels/index.e2e-spec.d.ts +0 -1
- package/lib/plugins/service-channels/index.e2e-spec.js +0 -57
- package/lib/plugins/service-channels/index.e2e-spec.js.map +0 -1
- package/lib/plugins/service-channels/index.js +0 -38
- package/lib/plugins/service-channels/index.js.map +0 -1
- package/lib/plugins/slack/index.d.ts +0 -9
- package/lib/plugins/slack/index.e2e-spec.d.ts +0 -1
- package/lib/plugins/slack/index.e2e-spec.js +0 -47
- package/lib/plugins/slack/index.e2e-spec.js.map +0 -1
- package/lib/plugins/slack/index.js +0 -47
- package/lib/plugins/slack/index.js.map +0 -1
- package/lib/plugins/utils.d.ts +0 -3
- package/lib/plugins/utils.js +0 -47
- package/lib/plugins/utils.js.map +0 -1
- package/oclif.manifest.json +0 -163
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sfdx-browserforce-plugin",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "sfdx plugin for browser automation",
|
|
5
5
|
"author": "Matthias Rolke <mr.amtrack@gmail.com>",
|
|
6
6
|
"type": "module",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@salesforce/dev-scripts": "11.0.4",
|
|
18
|
-
"oclif": "4.22.
|
|
18
|
+
"oclif": "4.22.27"
|
|
19
19
|
},
|
|
20
20
|
"files": [
|
|
21
21
|
"/bin",
|
|
@@ -58,8 +58,5 @@
|
|
|
58
58
|
"prepare": "npm run build",
|
|
59
59
|
"test": "tsc -p test && nyc --reporter=lcov --reporter=text mocha \"test/**/*.test.ts\" \"src/**/*.test.ts\"",
|
|
60
60
|
"test:e2e": "tsc -p test && mocha --slow 30s --timeout 2m --file test/e2e-setup.ts \"test/**/*.e2e-spec.ts\" \"src/**/*.e2e-spec.ts\""
|
|
61
|
-
},
|
|
62
|
-
"publishConfig": {
|
|
63
|
-
"provenance": true
|
|
64
61
|
}
|
|
65
62
|
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
-
import { Browserforce } from './browserforce.js';
|
|
3
|
-
export declare abstract class BrowserforceCommand<T> extends SfCommand<T> {
|
|
4
|
-
static baseFlags: {
|
|
5
|
-
'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
-
definitionfile: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
-
planfile: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
-
statefile: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
-
'flags-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
-
};
|
|
11
|
-
protected bf: Browserforce;
|
|
12
|
-
protected settings: any[];
|
|
13
|
-
init(): Promise<void>;
|
|
14
|
-
finally(err?: Error): Promise<void>;
|
|
15
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { Flags, SfCommand, Ux, requiredOrgFlagWithDeprecations, } from '@salesforce/sf-plugins-core';
|
|
2
|
-
import { promises } from 'fs';
|
|
3
|
-
import * as path from 'path';
|
|
4
|
-
import { Browserforce } from './browserforce.js';
|
|
5
|
-
import { ConfigParser } from './config-parser.js';
|
|
6
|
-
import { handleDeprecations } from './plugins/deprecated.js';
|
|
7
|
-
import * as DRIVERS from './plugins/index.js';
|
|
8
|
-
export class BrowserforceCommand extends SfCommand {
|
|
9
|
-
static baseFlags = {
|
|
10
|
-
...SfCommand.baseFlags,
|
|
11
|
-
'target-org': requiredOrgFlagWithDeprecations,
|
|
12
|
-
definitionfile: Flags.string({
|
|
13
|
-
char: 'f',
|
|
14
|
-
description: 'path to a browserforce state file',
|
|
15
|
-
}),
|
|
16
|
-
planfile: Flags.string({
|
|
17
|
-
char: 'p',
|
|
18
|
-
name: 'plan',
|
|
19
|
-
description: 'path to a browserforce plan file',
|
|
20
|
-
}),
|
|
21
|
-
statefile: Flags.string({
|
|
22
|
-
char: 's',
|
|
23
|
-
name: 'state',
|
|
24
|
-
description: 'path to a browserforce definition file\nThe schema is similar to the scratch org definition file.\nSee https://github.com/amtrack/sfdx-browserforce-plugin#supported-org-preferences for supported values.',
|
|
25
|
-
}),
|
|
26
|
-
};
|
|
27
|
-
bf;
|
|
28
|
-
settings;
|
|
29
|
-
async init() {
|
|
30
|
-
await super.init();
|
|
31
|
-
const { flags } = await this.parse({
|
|
32
|
-
baseFlags: BrowserforceCommand.baseFlags,
|
|
33
|
-
});
|
|
34
|
-
let definition;
|
|
35
|
-
if (flags.definitionfile) {
|
|
36
|
-
const definitionFileData = await promises.readFile(path.resolve(flags.definitionfile), 'utf8');
|
|
37
|
-
try {
|
|
38
|
-
definition = JSON.parse(definitionFileData);
|
|
39
|
-
}
|
|
40
|
-
catch (err) {
|
|
41
|
-
throw new Error('Failed parsing definitionfile');
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
handleDeprecations(definition);
|
|
45
|
-
// TODO: use require.resolve to dynamically load plugins from npm packages
|
|
46
|
-
this.settings = ConfigParser.parse(DRIVERS, definition);
|
|
47
|
-
this.bf = new Browserforce(flags['target-org'], new Ux({ jsonEnabled: this.jsonEnabled() }));
|
|
48
|
-
this.spinner.start('logging in');
|
|
49
|
-
await this.bf.login();
|
|
50
|
-
this.spinner.stop();
|
|
51
|
-
}
|
|
52
|
-
async finally(err) {
|
|
53
|
-
this.spinner.stop(err?.message);
|
|
54
|
-
if (this.bf) {
|
|
55
|
-
this.spinner.start('logging out');
|
|
56
|
-
await this.bf.logout();
|
|
57
|
-
this.spinner.stop();
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=browserforce-command.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"browserforce-command.js","sourceRoot":"","sources":["../src/browserforce-command.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,SAAS,EACT,EAAE,EACF,+BAA+B,GAChC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAE9C,MAAM,OAAgB,mBAAuB,SAAQ,SAAY;IAC/D,MAAM,CAAC,SAAS,GAAG;QACjB,GAAG,SAAS,CAAC,SAAS;QACtB,YAAY,EAAE,+BAA+B;QAC7C,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC;YAC3B,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,mCAAmC;SACjD,CAAC;QACF,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC;YACrB,IAAI,EAAE,GAAG;YACT,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,kCAAkC;SAChD,CAAC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AEM,KAAK,CAAC,OAAO,CAAC,GAAW;QAC9B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAChC,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC;YACZ,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;YAClC,MAAM,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC;YACvB,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACtB,CAAC;IACH,CAAC"}
|
package/lib/browserforce.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Org } from '@salesforce/core';
|
|
2
|
-
import { type Ux } from '@salesforce/sf-plugins-core';
|
|
3
|
-
import { Browser, Frame, Page, WaitForOptions } from 'puppeteer';
|
|
4
|
-
export declare class Browserforce {
|
|
5
|
-
org: Org;
|
|
6
|
-
logger?: Ux;
|
|
7
|
-
browser: Browser;
|
|
8
|
-
page: Page;
|
|
9
|
-
lightningSetupUrl: string;
|
|
10
|
-
constructor(org: Org, logger?: Ux);
|
|
11
|
-
login(): Promise<Browserforce>;
|
|
12
|
-
logout(): Promise<Browserforce>;
|
|
13
|
-
throwPageErrors(page: Page): Promise<void>;
|
|
14
|
-
getNewPage(): Promise<Page>;
|
|
15
|
-
openPage(urlPath: string, options?: WaitForOptions): Promise<Page>;
|
|
16
|
-
waitForSelectorInFrameOrPage(page: Page, selector: string): Promise<Page | Frame>;
|
|
17
|
-
getMyDomain(): string | null;
|
|
18
|
-
getInstanceUrl(): string;
|
|
19
|
-
/**
|
|
20
|
-
* @returns the setup url (e.g. https://[MyDomainName].my.salesforce-setup.com)
|
|
21
|
-
*/
|
|
22
|
-
getLightningSetupUrl(): Promise<string>;
|
|
23
|
-
}
|
|
24
|
-
export declare function throwPageErrors(page: Page): Promise<void>;
|
|
25
|
-
export declare function retry<T>(input: (attemptCount: number) => PromiseLike<T> | T): Promise<T>;
|
package/lib/browserforce.js
DELETED
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import pRetry from 'p-retry';
|
|
2
|
-
import { launch } from 'puppeteer';
|
|
3
|
-
import { LoginPage } from './pages/login.js';
|
|
4
|
-
const ERROR_DIV_SELECTOR = '#errorTitle';
|
|
5
|
-
const ERROR_DIVS_SELECTOR = 'div.errorMsg';
|
|
6
|
-
const VF_IFRAME_SELECTOR = 'force-aloha-page iframe[name^=vfFrameId]';
|
|
7
|
-
export class Browserforce {
|
|
8
|
-
org;
|
|
9
|
-
logger;
|
|
10
|
-
browser;
|
|
11
|
-
page;
|
|
12
|
-
lightningSetupUrl;
|
|
13
|
-
constructor(org, logger) {
|
|
14
|
-
this.org = org;
|
|
15
|
-
this.logger = logger;
|
|
16
|
-
}
|
|
17
|
-
async login() {
|
|
18
|
-
this.browser = await launch({
|
|
19
|
-
args: [
|
|
20
|
-
'--no-sandbox',
|
|
21
|
-
'--disable-setuid-sandbox',
|
|
22
|
-
// workaround for navigating frames https://github.com/puppeteer/puppeteer/issues/5123
|
|
23
|
-
'--disable-features=site-per-process',
|
|
24
|
-
],
|
|
25
|
-
headless: !(process.env.BROWSER_DEBUG === 'true'),
|
|
26
|
-
slowMo: parseInt(process.env.BROWSER_SLOWMO, 10) ?? 0,
|
|
27
|
-
});
|
|
28
|
-
const page = await this.getNewPage();
|
|
29
|
-
try {
|
|
30
|
-
const loginPage = new LoginPage(page);
|
|
31
|
-
await loginPage.login(this.org);
|
|
32
|
-
}
|
|
33
|
-
finally {
|
|
34
|
-
await page.close();
|
|
35
|
-
}
|
|
36
|
-
return this;
|
|
37
|
-
}
|
|
38
|
-
async logout() {
|
|
39
|
-
if (this.browser) {
|
|
40
|
-
await this.browser.close();
|
|
41
|
-
}
|
|
42
|
-
return this;
|
|
43
|
-
}
|
|
44
|
-
async throwPageErrors(page) {
|
|
45
|
-
await throwPageErrors(page);
|
|
46
|
-
}
|
|
47
|
-
async getNewPage() {
|
|
48
|
-
const page = await this.browser.newPage();
|
|
49
|
-
page.setDefaultNavigationTimeout(parseInt(process.env.BROWSERFORCE_NAVIGATION_TIMEOUT_MS ?? '90000', 10));
|
|
50
|
-
await page.setViewport({ width: 1024, height: 768 });
|
|
51
|
-
return page;
|
|
52
|
-
}
|
|
53
|
-
// path instead of url
|
|
54
|
-
async openPage(urlPath, options) {
|
|
55
|
-
let page;
|
|
56
|
-
const result = await pRetry(async () => {
|
|
57
|
-
page = await this.getNewPage();
|
|
58
|
-
const setupUrl = urlPath.startsWith('lightning')
|
|
59
|
-
? await this.getLightningSetupUrl()
|
|
60
|
-
: this.getInstanceUrl();
|
|
61
|
-
const url = `${setupUrl}/${urlPath}`;
|
|
62
|
-
const response = await page.goto(url, options);
|
|
63
|
-
if (response) {
|
|
64
|
-
if (!response.ok()) {
|
|
65
|
-
await this.throwPageErrors(page);
|
|
66
|
-
throw new Error(`${response.status()}: ${response.statusText()}`);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return page;
|
|
70
|
-
}, {
|
|
71
|
-
onFailedAttempt: async (context) => {
|
|
72
|
-
if (this.logger) {
|
|
73
|
-
this.logger.warn(`retrying ${context.retriesLeft} more time(s) because of "${context.error}"`);
|
|
74
|
-
}
|
|
75
|
-
if (page) {
|
|
76
|
-
try {
|
|
77
|
-
await page.close();
|
|
78
|
-
}
|
|
79
|
-
catch (e) {
|
|
80
|
-
// not handled
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
retries: parseInt(process.env.BROWSERFORCE_RETRY_MAX_RETRIES ?? '4', 10),
|
|
85
|
-
minTimeout: parseInt(process.env.BROWSERFORCE_RETRY_TIMEOUT_MS ?? '4000', 10),
|
|
86
|
-
});
|
|
87
|
-
return result;
|
|
88
|
-
}
|
|
89
|
-
// If LEX is enabled, the classic url will be opened in an iframe.
|
|
90
|
-
// Wait for either the selector in the page or in the iframe.
|
|
91
|
-
// returns the page or the frame
|
|
92
|
-
async waitForSelectorInFrameOrPage(page, selector) {
|
|
93
|
-
await page.locator(`${selector}, ${VF_IFRAME_SELECTOR}`).wait();
|
|
94
|
-
const frameElementHandle = await page.$(VF_IFRAME_SELECTOR);
|
|
95
|
-
let frameOrPage = page;
|
|
96
|
-
if (frameElementHandle) {
|
|
97
|
-
const frame = await page.waitForFrame(async (f) => f.name().startsWith('vfFrameId') &&
|
|
98
|
-
f.url()?.length > 0 &&
|
|
99
|
-
f.url() !== 'about:blank');
|
|
100
|
-
frameOrPage = frame;
|
|
101
|
-
}
|
|
102
|
-
await frameOrPage.locator(selector).wait();
|
|
103
|
-
return frameOrPage;
|
|
104
|
-
}
|
|
105
|
-
getMyDomain() {
|
|
106
|
-
const instanceUrl = this.getInstanceUrl();
|
|
107
|
-
// acme.my.salesforce.com
|
|
108
|
-
// acme--<sandboxName>.csN.my.salesforce.com
|
|
109
|
-
const matches = instanceUrl.match(/https:\/\/(.*)\.my\.salesforce\.com/);
|
|
110
|
-
if (matches) {
|
|
111
|
-
return matches[1];
|
|
112
|
-
}
|
|
113
|
-
return null;
|
|
114
|
-
}
|
|
115
|
-
getInstanceUrl() {
|
|
116
|
-
// sometimes the instanceUrl includes a trailing slash
|
|
117
|
-
return this.org.getConnection().instanceUrl?.replace(/\/$/, '');
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* @returns the setup url (e.g. https://[MyDomainName].my.salesforce-setup.com)
|
|
121
|
-
*/
|
|
122
|
-
async getLightningSetupUrl() {
|
|
123
|
-
if (!this.lightningSetupUrl) {
|
|
124
|
-
const page = await this.getNewPage();
|
|
125
|
-
try {
|
|
126
|
-
const lightningResponse = await page.goto(`${this.getInstanceUrl()}/lightning/setup/SetupOneHome/home`, { waitUntil: ['load', 'networkidle2'] });
|
|
127
|
-
this.lightningSetupUrl = new URL(lightningResponse.url()).origin;
|
|
128
|
-
}
|
|
129
|
-
finally {
|
|
130
|
-
await page.close();
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
return this.lightningSetupUrl;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
export async function throwPageErrors(page) {
|
|
137
|
-
const errorHandle = await page.$(ERROR_DIV_SELECTOR);
|
|
138
|
-
if (errorHandle) {
|
|
139
|
-
const errorMsg = await page.evaluate((div) => div.innerText, errorHandle);
|
|
140
|
-
await errorHandle.dispose();
|
|
141
|
-
if (errorMsg && errorMsg.trim()) {
|
|
142
|
-
throw new Error(errorMsg.trim());
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
const errorElements = await page.$$(ERROR_DIVS_SELECTOR);
|
|
146
|
-
if (errorElements.length) {
|
|
147
|
-
const errorMessages = await page.evaluate((...errorDivs) => {
|
|
148
|
-
return errorDivs.map((div) => div.innerText);
|
|
149
|
-
}, ...errorElements);
|
|
150
|
-
const errorMsg = errorMessages
|
|
151
|
-
.map((m) => m.trim())
|
|
152
|
-
.join(' ')
|
|
153
|
-
.trim();
|
|
154
|
-
if (errorMsg) {
|
|
155
|
-
throw new Error(errorMsg);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
export async function retry(input) {
|
|
160
|
-
const res = await pRetry(input, {
|
|
161
|
-
onFailedAttempt: (context) => {
|
|
162
|
-
console.warn(`retrying ${context.retriesLeft} more time(s) because of "${context.error}"`);
|
|
163
|
-
},
|
|
164
|
-
retries: parseInt(process.env.BROWSERFORCE_RETRY_MAX_RETRIES ?? '6', 10),
|
|
165
|
-
minTimeout: parseInt(process.env.BROWSERFORCE_RETRY_TIMEOUT_MS ?? '4000', 10),
|
|
166
|
-
});
|
|
167
|
-
return res;
|
|
168
|
-
}
|
|
169
|
-
//# sourceMappingURL=browserforce.js.map
|
package/lib/browserforce.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"browserforce.js","sourceRoot":"","sources":["../src/browserforce.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAkB,MAAM,EAAwB,MAAM,WAAW,C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B,OAAO,CAAC,IAAI,CACV,YAAY,OAAO,CAAC,WAAW,6BAA6B,OAAO,CAAC,KAAK,GAAG,CAC7E,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,8BAA8B,IAAI,GAAG,EAAE,EAAE,CAAC;QACxE,UAAU,EAAE,QAAQ,CAClB,OAAO,CAAC,GAAG,CAAC,6BAA6B,IAAI,MAAM,EACnD,EAAE,CACH;KACF,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { BrowserforceCommand } from '../../browserforce-command.js';
|
|
2
|
-
type BrowserforceApplyResponse = {
|
|
3
|
-
success: boolean;
|
|
4
|
-
};
|
|
5
|
-
export declare class BrowserforceApply extends BrowserforceCommand<BrowserforceApplyResponse> {
|
|
6
|
-
static description: string;
|
|
7
|
-
static examples: string[];
|
|
8
|
-
run(): Promise<BrowserforceApplyResponse>;
|
|
9
|
-
}
|
|
10
|
-
export {};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { BrowserforceCommand } from '../../browserforce-command.js';
|
|
2
|
-
export class BrowserforceApply extends BrowserforceCommand {
|
|
3
|
-
static description = 'apply a plan from a definition file';
|
|
4
|
-
static examples = [
|
|
5
|
-
`$ <%= config.bin %> <%= command.id %> -f ./config/currency.json --target-org myOrg@example.com
|
|
6
|
-
logging in... done
|
|
7
|
-
Applying definition file ./config/currency.json to org myOrg@example.com
|
|
8
|
-
[CompanyInformation] retrieving state... done
|
|
9
|
-
[CompanyInformation] changing 'defaultCurrencyIsoCode' to '"English (South Africa) - ZAR"'... done
|
|
10
|
-
logging out... done
|
|
11
|
-
`,
|
|
12
|
-
];
|
|
13
|
-
async run() {
|
|
14
|
-
const { flags } = await this.parse(BrowserforceApply);
|
|
15
|
-
this.log(`Applying definition file ${flags.definitionfile} to org ${flags['target-org'].getUsername()}`);
|
|
16
|
-
for (const setting of this.settings) {
|
|
17
|
-
const driver = setting.Driver;
|
|
18
|
-
const instance = new driver(this.bf);
|
|
19
|
-
this.spinner.start(`[${driver.name}] retrieving state`);
|
|
20
|
-
let state;
|
|
21
|
-
try {
|
|
22
|
-
state = await instance.retrieve(setting.value);
|
|
23
|
-
}
|
|
24
|
-
catch (err) {
|
|
25
|
-
this.spinner.stop('failed');
|
|
26
|
-
throw err;
|
|
27
|
-
}
|
|
28
|
-
this.spinner.stop();
|
|
29
|
-
const diff = instance.diff(state, setting.value);
|
|
30
|
-
if (diff !== undefined) {
|
|
31
|
-
this.spinner.start(`[${driver.name}] ${Object.keys(diff)
|
|
32
|
-
.map((key) => {
|
|
33
|
-
return `changing '${key}' to '${JSON.stringify(diff[key])}'`;
|
|
34
|
-
})
|
|
35
|
-
.join('\n')}`);
|
|
36
|
-
try {
|
|
37
|
-
await instance.apply(diff);
|
|
38
|
-
}
|
|
39
|
-
catch (err) {
|
|
40
|
-
this.spinner.stop('failed');
|
|
41
|
-
throw err;
|
|
42
|
-
}
|
|
43
|
-
this.spinner.stop();
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
this.log(`[${driver.name}] no action necessary`);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return {
|
|
50
|
-
success: true,
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=apply.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"apply.js","sourceRoot":"","sources":["../../../src/commands/browserforce/apply.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAMpE,MAAM,OAAO,iBAAkB,SAAQ,mBAA8C;IAC5E,MAAM,CAAC,WAAW,GAAG,qCAAqC,CAAC;IAC3D,MAAM,CAAC,QAAQ,GAAG;QACvB;;;;;;GAMD;KACA,CAAC;IAEK,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,G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MAAM,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAC7B,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;oBAC5B,MAAM,GAAG,CAAC;gBACZ,CAAC;gBACD,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YACtB,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,IAAI,uBAAuB,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;QACD,OAAO;YACL,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { BrowserforceCommand } from '../../browserforce-command.js';
|
|
2
|
-
type BrowserforceApplyResponse = {
|
|
3
|
-
success: boolean;
|
|
4
|
-
};
|
|
5
|
-
export declare class BrowserforcePlanCommand extends BrowserforceCommand<BrowserforceApplyResponse> {
|
|
6
|
-
static description: string;
|
|
7
|
-
static examples: string[];
|
|
8
|
-
run(): Promise<BrowserforceApplyResponse>;
|
|
9
|
-
}
|
|
10
|
-
export {};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { writeFile } from 'fs/promises';
|
|
2
|
-
import * as path from 'path';
|
|
3
|
-
import { BrowserforceCommand } from '../../browserforce-command.js';
|
|
4
|
-
export class BrowserforcePlanCommand extends BrowserforceCommand {
|
|
5
|
-
static description = 'retrieve state and generate plan file';
|
|
6
|
-
static examples = [
|
|
7
|
-
`$ <%= config.bin %> <%= command.id %> -f ./config/currency.json --target-org myOrg@example.com
|
|
8
|
-
logging in... done
|
|
9
|
-
Generating plan with definition file ./config/currency.json from org myOrg@example.com
|
|
10
|
-
[CompanyInformation] retrieving state... done
|
|
11
|
-
[CompanyInformation] generating plan... done
|
|
12
|
-
logging out... done
|
|
13
|
-
`,
|
|
14
|
-
];
|
|
15
|
-
async run() {
|
|
16
|
-
const { flags } = await this.parse(BrowserforcePlanCommand);
|
|
17
|
-
this.log(`Generating plan with definition file ${flags.definitionfile} from org ${flags['target-org'].getUsername()}`);
|
|
18
|
-
const state = {
|
|
19
|
-
settings: {},
|
|
20
|
-
};
|
|
21
|
-
const plan = {
|
|
22
|
-
settings: {},
|
|
23
|
-
};
|
|
24
|
-
for (const setting of this.settings) {
|
|
25
|
-
const driver = setting.Driver;
|
|
26
|
-
const instance = new driver(this.bf);
|
|
27
|
-
this.spinner.start(`[${driver.name}] retrieving state`);
|
|
28
|
-
let driverState;
|
|
29
|
-
try {
|
|
30
|
-
driverState = await instance.retrieve(setting.value);
|
|
31
|
-
state.settings[setting.key] = driverState;
|
|
32
|
-
}
|
|
33
|
-
catch (err) {
|
|
34
|
-
this.spinner.stop('failed');
|
|
35
|
-
throw err;
|
|
36
|
-
}
|
|
37
|
-
this.spinner.stop();
|
|
38
|
-
this.spinner.start(`[${driver.name}] generating plan`);
|
|
39
|
-
const driverPlan = instance.diff(driverState, setting.value);
|
|
40
|
-
plan.settings[setting.key] = driverPlan;
|
|
41
|
-
this.spinner.stop();
|
|
42
|
-
}
|
|
43
|
-
if (flags.statefile) {
|
|
44
|
-
this.spinner.start('writing state file');
|
|
45
|
-
await writeFile(path.resolve(flags.statefile), JSON.stringify(state, null, 2));
|
|
46
|
-
this.spinner.stop();
|
|
47
|
-
}
|
|
48
|
-
if (flags.planfile) {
|
|
49
|
-
this.spinner.start('writing plan file');
|
|
50
|
-
await writeFile(path.resolve(flags.planfile), JSON.stringify(plan, null, 2));
|
|
51
|
-
this.spinner.stop();
|
|
52
|
-
}
|
|
53
|
-
return { success: true };
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=plan.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../../../src/commands/browserforce/plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,C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C,IAAI,EAAE,CAAC;YACpB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,mBAAmB,CAAC,CAAC;YACvD,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;YAC7D,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC;YACxC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACtB,CAAC;QACD,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;YACpB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;YACzC,MAAM,SAAS,CACb,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,EAC7B,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAC/B,CAAC;YACF,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACtB,CAAC;QACD,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YACnB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;YACxC,MAAM,SAAS,CACb,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,EAC5B,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAC9B,CAAC;YACF,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QACtB,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC"}
|
package/lib/config-parser.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { BrowserforcePlugin } from './plugin.js';
|
|
2
|
-
type Drivers = {
|
|
3
|
-
[key: string]: typeof BrowserforcePlugin;
|
|
4
|
-
};
|
|
5
|
-
type Data = {
|
|
6
|
-
settings?: unknown;
|
|
7
|
-
};
|
|
8
|
-
type Config = {
|
|
9
|
-
Driver: typeof BrowserforcePlugin;
|
|
10
|
-
key: string;
|
|
11
|
-
value: unknown;
|
|
12
|
-
};
|
|
13
|
-
export declare class ConfigParser {
|
|
14
|
-
static parse(drivers: Drivers, data: Data): Config[];
|
|
15
|
-
}
|
|
16
|
-
export {};
|
package/lib/config-parser.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export class ConfigParser {
|
|
2
|
-
static parse(drivers, data) {
|
|
3
|
-
const settings = [];
|
|
4
|
-
if (data?.settings) {
|
|
5
|
-
for (const driverName of Object.keys(data.settings)) {
|
|
6
|
-
if (drivers[driverName]) {
|
|
7
|
-
settings.push({
|
|
8
|
-
Driver: drivers[driverName],
|
|
9
|
-
key: driverName,
|
|
10
|
-
value: data.settings[driverName],
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
throw new Error(`Could not find plugin named '${driverName}' in definition: ${JSON.stringify(data)}`);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
throw new Error(`Missing 'settings' attribute in definition: ${JSON.stringify(data)}`);
|
|
20
|
-
}
|
|
21
|
-
return settings;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=config-parser.js.map
|
package/lib/config-parser.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config-parser.js","sourceRoot":"","sources":["../src/config-parser.ts"],"names":[],"mappings":"AAgBA,MAAM,OAAO,YAAY;IAChB,MAAM,CAAC,KAAK,CAAC,OAAgB,EAAE,IAAU;QAC9C,MAAM,QAAQ,GAAa,EAAE,CAAC;QAC9B,IAAI,IAAI,EAAE,QAAQ,EAAE,CAAC;YACnB,KAAK,MAAM,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACpD,IAAI,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;oBACxB,QAAQ,CAAC,IAAI,CAAC;wBACZ,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC;wBAC3B,GAAG,EAAE,UAAU;wBACf,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;qBACjC,CAAC,CAAC;gBACL,CAAC;qBAAM,CAAC;oBACN,MAAM,IAAI,KAAK,CACb,gCAAgC,UAAU,oBAAoB,IAAI,CAAC,SAAS,CAC1E,IAAI,CACL,EAAE,CACJ,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CACb,+CAA+C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CACtE,CAAC;QACJ,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
|
package/lib/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/index.js
DELETED
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/lib/jsforce-utils.d.ts
DELETED
package/lib/jsforce-utils.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* workaround as the Metadata API (converted from XML) returns an object instead of an array of length 1
|
|
3
|
-
* @param prop result of a Metadata API call (array or object)
|
|
4
|
-
*/
|
|
5
|
-
export function ensureArray(prop) {
|
|
6
|
-
if (Array.isArray(prop)) {
|
|
7
|
-
return prop;
|
|
8
|
-
}
|
|
9
|
-
if (prop === undefined || prop === null) {
|
|
10
|
-
return [];
|
|
11
|
-
}
|
|
12
|
-
return [prop];
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=jsforce-utils.js.map
|
package/lib/jsforce-utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsforce-utils.js","sourceRoot":"","sources":["../src/jsforce-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAI,IAAa;IAC1C,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QACxC,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
|
package/lib/pages/login.d.ts
DELETED
package/lib/pages/login.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
const FRONT_DOOR_PATH = 'secur/frontdoor.jsp';
|
|
2
|
-
const POST_LOGIN_PATH = 'setup/forcecomHomepage.apexp';
|
|
3
|
-
const ERROR_DIV_SELECTOR = '#error';
|
|
4
|
-
export class LoginPage {
|
|
5
|
-
page;
|
|
6
|
-
constructor(page) {
|
|
7
|
-
this.page = page;
|
|
8
|
-
}
|
|
9
|
-
async login(org) {
|
|
10
|
-
try {
|
|
11
|
-
await org.refreshAuth();
|
|
12
|
-
}
|
|
13
|
-
catch (_) {
|
|
14
|
-
throw new Error('login failed');
|
|
15
|
-
}
|
|
16
|
-
const conn = org.getConnection();
|
|
17
|
-
const response = await this.page.goto(`${conn.instanceUrl.replace(/\/$/, '')}/${FRONT_DOOR_PATH}?sid=${conn.accessToken}&retURL=${encodeURIComponent(POST_LOGIN_PATH)}`, {
|
|
18
|
-
// should have waited at least 500ms for network connections, redirects should probably have happened already
|
|
19
|
-
waitUntil: ['load', 'networkidle2'],
|
|
20
|
-
});
|
|
21
|
-
const url = new URL(response.url());
|
|
22
|
-
if (url.searchParams.has('startURL')) {
|
|
23
|
-
// when query param startURL exists, the login failed
|
|
24
|
-
// e.g. /?ec=302&startURL=https...
|
|
25
|
-
await this.throwPageErrors();
|
|
26
|
-
}
|
|
27
|
-
return this;
|
|
28
|
-
}
|
|
29
|
-
async throwPageErrors() {
|
|
30
|
-
const errorHandle = await this.page.$(ERROR_DIV_SELECTOR);
|
|
31
|
-
if (errorHandle) {
|
|
32
|
-
const errorMessage = (await this.page.evaluate((div) => div.innerText, errorHandle))?.trim();
|
|
33
|
-
if (errorMessage) {
|
|
34
|
-
throw new Error(errorMessage);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=login.js.map
|
package/lib/pages/login.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/pages/login.ts"],"names":[],"mappings":"AAGA,MAAM,eAAe,GAAG,qBAAqB,CAAC;AAC9C,MAAM,eAAe,GAAG,8BAA8B,CAAC;AAEvD,MAAM,kBAAkB,GAAG,QAAQ,CAAC;AAEpC,MAAM,OAAO,SAAS;IACZ,IAAI,CAAO;IAEnB,YAAY,IAAU;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,GAAQ;QAClB,IAAI,CAAC;YACH,MAAM,GAAG,CAAC,WAAW,EAAE,CAAC;QAC1B,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;QAClC,CAAC;QACD,MAAM,IAAI,GAAG,GAAG,CAAC,aAAa,EAAE,CAAC;QACjC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CACnC,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,eAAe,QACvD,IAAI,CAAC,WACP,WAAW,kBAAkB,CAAC,eAAe,CAAC,EAAE,EAChD;YACE,6GAA6G;YAC7G,SAAS,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC;SACpC,CACF,CAAC;QACF,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC;QACpC,IAAI,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;YACrC,qDAAqD;YACrD,kCAAkC;YAClC,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;QAC/B,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC;QAC1D,IAAI,WAAW,EAAE,CAAC;YAChB,MAAM,YAAY,GAAG,CACnB,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CACtB,CAAC,GAAmB,EAAE,EAAE,CAAC,GAAG,CAAC,SAAS,EACtC,WAAW,CACZ,CACF,EAAE,IAAI,EAAE,CAAC;YACV,IAAI,YAAY,EAAE,CAAC;gBACjB,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
package/lib/plugin.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Org } from '@salesforce/core';
|
|
2
|
-
import { Browserforce } from './browserforce.js';
|
|
3
|
-
export declare abstract class BrowserforcePlugin {
|
|
4
|
-
protected browserforce: Browserforce;
|
|
5
|
-
protected org: Org;
|
|
6
|
-
constructor(browserforce: Browserforce);
|
|
7
|
-
abstract retrieve(definition?: unknown): Promise<unknown>;
|
|
8
|
-
/**
|
|
9
|
-
* deep diff
|
|
10
|
-
* @param state
|
|
11
|
-
* @param definition
|
|
12
|
-
* @returns undefined when there is no diff
|
|
13
|
-
*/
|
|
14
|
-
diff(state: unknown, definition: unknown): unknown;
|
|
15
|
-
abstract apply(plan: unknown): Promise<unknown>;
|
|
16
|
-
run(definition: unknown): Promise<unknown>;
|
|
17
|
-
}
|
package/lib/plugin.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { deepDiff } from './plugins/utils.js';
|
|
2
|
-
export class BrowserforcePlugin {
|
|
3
|
-
browserforce;
|
|
4
|
-
org;
|
|
5
|
-
constructor(browserforce) {
|
|
6
|
-
this.browserforce = browserforce;
|
|
7
|
-
this.org = browserforce?.org;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* deep diff
|
|
11
|
-
* @param state
|
|
12
|
-
* @param definition
|
|
13
|
-
* @returns undefined when there is no diff
|
|
14
|
-
*/
|
|
15
|
-
diff(state, definition) {
|
|
16
|
-
return deepDiff(state, definition);
|
|
17
|
-
}
|
|
18
|
-
async run(definition) {
|
|
19
|
-
const state = await this.retrieve(definition);
|
|
20
|
-
const diff = this.diff(state, definition);
|
|
21
|
-
if (diff !== undefined) {
|
|
22
|
-
const result = await this.apply(diff);
|
|
23
|
-
return result;
|
|
24
|
-
}
|
|
25
|
-
return {
|
|
26
|
-
message: 'no action necessary',
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=plugin.js.map
|