sf-browserforce 1.0.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/LICENSE +21 -0
- package/README.md +266 -0
- package/bin/run +9 -0
- package/bin/run.cmd +3 -0
- package/lib/browserforce-command.d.ts +27 -0
- package/lib/browserforce-command.js +162 -0
- package/lib/browserforce-command.js.map +1 -0
- package/lib/browserforce.d.ts +27 -0
- package/lib/browserforce.js +163 -0
- package/lib/browserforce.js.map +1 -0
- package/lib/commands/browserforce/apply.d.ts +10 -0
- package/lib/commands/browserforce/apply.js +83 -0
- package/lib/commands/browserforce/apply.js.map +1 -0
- package/lib/commands/browserforce/playwright.d.ts +9 -0
- package/lib/commands/browserforce/playwright.js +53 -0
- package/lib/commands/browserforce/playwright.js.map +1 -0
- package/lib/config-parser.d.ts +16 -0
- package/lib/config-parser.js +24 -0
- package/lib/config-parser.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -0
- package/lib/jsforce-utils.d.ts +5 -0
- package/lib/jsforce-utils.js +14 -0
- package/lib/jsforce-utils.js.map +1 -0
- package/lib/pages/login.d.ts +7 -0
- package/lib/pages/login.js +17 -0
- package/lib/pages/login.js.map +1 -0
- package/lib/plugin.d.ts +15 -0
- package/lib/plugin.js +28 -0
- package/lib/plugin.js.map +1 -0
- package/lib/plugins/activity-settings/index.d.ts +9 -0
- package/lib/plugins/activity-settings/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/activity-settings/index.e2e-spec.js +36 -0
- package/lib/plugins/activity-settings/index.e2e-spec.js.map +1 -0
- package/lib/plugins/activity-settings/index.js +102 -0
- package/lib/plugins/activity-settings/index.js.map +1 -0
- package/lib/plugins/auth-providers/index.d.ts +13 -0
- package/lib/plugins/auth-providers/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/auth-providers/index.e2e-spec.js +78 -0
- package/lib/plugins/auth-providers/index.e2e-spec.js.map +1 -0
- package/lib/plugins/auth-providers/index.js +135 -0
- package/lib/plugins/auth-providers/index.js.map +1 -0
- package/lib/plugins/company-information/index.d.ts +8 -0
- package/lib/plugins/company-information/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/company-information/index.e2e-spec.js +37 -0
- package/lib/plugins/company-information/index.e2e-spec.js.map +1 -0
- package/lib/plugins/company-information/index.js +114 -0
- package/lib/plugins/company-information/index.js.map +1 -0
- package/lib/plugins/customer-portal/available-custom-objects/index.d.ts +14 -0
- package/lib/plugins/customer-portal/available-custom-objects/index.js +203 -0
- package/lib/plugins/customer-portal/available-custom-objects/index.js.map +1 -0
- package/lib/plugins/customer-portal/available-custom-objects/index.test.d.ts +1 -0
- package/lib/plugins/customer-portal/available-custom-objects/index.test.js +39 -0
- package/lib/plugins/customer-portal/available-custom-objects/index.test.js.map +1 -0
- package/lib/plugins/customer-portal/enabled/index.d.ts +6 -0
- package/lib/plugins/customer-portal/enabled/index.js +89 -0
- package/lib/plugins/customer-portal/enabled/index.js.map +1 -0
- package/lib/plugins/customer-portal/enabled/index.test.d.ts +1 -0
- package/lib/plugins/customer-portal/enabled/index.test.js +34 -0
- package/lib/plugins/customer-portal/enabled/index.test.js.map +1 -0
- package/lib/plugins/customer-portal/index.d.ts +15 -0
- package/lib/plugins/customer-portal/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/customer-portal/index.e2e-spec.js +188 -0
- package/lib/plugins/customer-portal/index.e2e-spec.js.map +1 -0
- package/lib/plugins/customer-portal/index.js +58 -0
- package/lib/plugins/customer-portal/index.js.map +1 -0
- package/lib/plugins/customer-portal/index.test.d.ts +1 -0
- package/lib/plugins/customer-portal/index.test.js +84 -0
- package/lib/plugins/customer-portal/index.test.js.map +1 -0
- package/lib/plugins/customer-portal/portals/index.d.ts +25 -0
- package/lib/plugins/customer-portal/portals/index.js +254 -0
- package/lib/plugins/customer-portal/portals/index.js.map +1 -0
- package/lib/plugins/customer-portal/portals/index.test.d.ts +1 -0
- package/lib/plugins/customer-portal/portals/index.test.js +140 -0
- package/lib/plugins/customer-portal/portals/index.test.js.map +1 -0
- package/lib/plugins/density-settings/index.d.ts +10 -0
- package/lib/plugins/density-settings/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/density-settings/index.e2e-spec.js +39 -0
- package/lib/plugins/density-settings/index.e2e-spec.js.map +1 -0
- package/lib/plugins/density-settings/index.js +101 -0
- package/lib/plugins/density-settings/index.js.map +1 -0
- package/lib/plugins/deprecated.d.ts +4 -0
- package/lib/plugins/deprecated.js +28 -0
- package/lib/plugins/deprecated.js.map +1 -0
- package/lib/plugins/email-deliverability/index.d.ts +9 -0
- package/lib/plugins/email-deliverability/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/email-deliverability/index.e2e-spec.js +55 -0
- package/lib/plugins/email-deliverability/index.e2e-spec.js.map +1 -0
- package/lib/plugins/email-deliverability/index.js +109 -0
- package/lib/plugins/email-deliverability/index.js.map +1 -0
- package/lib/plugins/high-velocity-sales-settings/index.d.ts +10 -0
- package/lib/plugins/high-velocity-sales-settings/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/high-velocity-sales-settings/index.e2e-spec.js +29 -0
- package/lib/plugins/high-velocity-sales-settings/index.e2e-spec.js.map +1 -0
- package/lib/plugins/high-velocity-sales-settings/index.js +105 -0
- package/lib/plugins/high-velocity-sales-settings/index.js.map +1 -0
- package/lib/plugins/high-velocity-sales-settings/page.d.ts +8 -0
- package/lib/plugins/high-velocity-sales-settings/page.js +27 -0
- package/lib/plugins/high-velocity-sales-settings/page.js.map +1 -0
- package/lib/plugins/history-tracking/index.d.ts +19 -0
- package/lib/plugins/history-tracking/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/history-tracking/index.e2e-spec.js +128 -0
- package/lib/plugins/history-tracking/index.e2e-spec.js.map +1 -0
- package/lib/plugins/history-tracking/index.js +272 -0
- package/lib/plugins/history-tracking/index.js.map +1 -0
- package/lib/plugins/home-page-layouts/index.d.ts +14 -0
- package/lib/plugins/home-page-layouts/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/home-page-layouts/index.e2e-spec.js +47 -0
- package/lib/plugins/home-page-layouts/index.e2e-spec.js.map +1 -0
- package/lib/plugins/home-page-layouts/index.js +145 -0
- package/lib/plugins/home-page-layouts/index.js.map +1 -0
- package/lib/plugins/home-page-layouts/index.test.d.ts +1 -0
- package/lib/plugins/home-page-layouts/index.test.js +104 -0
- package/lib/plugins/home-page-layouts/index.test.js.map +1 -0
- package/lib/plugins/index.d.ts +28 -0
- package/lib/plugins/index.js +29 -0
- package/lib/plugins/index.js.map +1 -0
- package/lib/plugins/lightning-experience-settings/index.d.ts +17 -0
- package/lib/plugins/lightning-experience-settings/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/lightning-experience-settings/index.e2e-spec.js +48 -0
- package/lib/plugins/lightning-experience-settings/index.e2e-spec.js.map +1 -0
- package/lib/plugins/lightning-experience-settings/index.js +149 -0
- package/lib/plugins/lightning-experience-settings/index.js.map +1 -0
- package/lib/plugins/linkedin-sales-navigator-settings/index.d.ts +8 -0
- package/lib/plugins/linkedin-sales-navigator-settings/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/linkedin-sales-navigator-settings/index.e2e-spec.js +29 -0
- package/lib/plugins/linkedin-sales-navigator-settings/index.e2e-spec.js.map +1 -0
- package/lib/plugins/linkedin-sales-navigator-settings/index.js +93 -0
- package/lib/plugins/linkedin-sales-navigator-settings/index.js.map +1 -0
- package/lib/plugins/linkedin-sales-navigator-settings/page.d.ts +9 -0
- package/lib/plugins/linkedin-sales-navigator-settings/page.js +35 -0
- package/lib/plugins/linkedin-sales-navigator-settings/page.js.map +1 -0
- package/lib/plugins/login-as-user/index.d.ts +9 -0
- package/lib/plugins/login-as-user/index.js +104 -0
- package/lib/plugins/login-as-user/index.js.map +1 -0
- package/lib/plugins/logout-login-as-user/index.d.ts +6 -0
- package/lib/plugins/logout-login-as-user/index.js +76 -0
- package/lib/plugins/logout-login-as-user/index.js.map +1 -0
- package/lib/plugins/omni-channel-settings/index.d.ts +9 -0
- package/lib/plugins/omni-channel-settings/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/omni-channel-settings/index.e2e-spec.js +30 -0
- package/lib/plugins/omni-channel-settings/index.e2e-spec.js.map +1 -0
- package/lib/plugins/omni-channel-settings/index.js +97 -0
- package/lib/plugins/omni-channel-settings/index.js.map +1 -0
- package/lib/plugins/opportunity-splits/index.d.ts +9 -0
- package/lib/plugins/opportunity-splits/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/opportunity-splits/index.e2e-spec.js +46 -0
- package/lib/plugins/opportunity-splits/index.e2e-spec.js.map +1 -0
- package/lib/plugins/opportunity-splits/index.js +117 -0
- package/lib/plugins/opportunity-splits/index.js.map +1 -0
- package/lib/plugins/opportunity-splits/pages/layout-selection.d.ts +8 -0
- package/lib/plugins/opportunity-splits/pages/layout-selection.js +15 -0
- package/lib/plugins/opportunity-splits/pages/layout-selection.js.map +1 -0
- package/lib/plugins/opportunity-splits/pages/overview.d.ts +11 -0
- package/lib/plugins/opportunity-splits/pages/overview.js +32 -0
- package/lib/plugins/opportunity-splits/pages/overview.js.map +1 -0
- package/lib/plugins/opportunity-splits/pages/setup.d.ts +9 -0
- package/lib/plugins/opportunity-splits/pages/setup.js +17 -0
- package/lib/plugins/opportunity-splits/pages/setup.js.map +1 -0
- package/lib/plugins/permission-sets/index.d.ts +10 -0
- package/lib/plugins/permission-sets/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/permission-sets/index.e2e-spec.js +47 -0
- package/lib/plugins/permission-sets/index.e2e-spec.js.map +1 -0
- package/lib/plugins/permission-sets/index.js +22 -0
- package/lib/plugins/permission-sets/index.js.map +1 -0
- package/lib/plugins/permission-sets/service-presence-status/index.d.ts +10 -0
- package/lib/plugins/permission-sets/service-presence-status/index.js +124 -0
- package/lib/plugins/permission-sets/service-presence-status/index.js.map +1 -0
- package/lib/plugins/picklists/field-dependencies/index.d.ts +11 -0
- package/lib/plugins/picklists/field-dependencies/index.js +133 -0
- package/lib/plugins/picklists/field-dependencies/index.js.map +1 -0
- package/lib/plugins/picklists/field-dependencies/index.test.d.ts +1 -0
- package/lib/plugins/picklists/field-dependencies/index.test.js +64 -0
- package/lib/plugins/picklists/field-dependencies/index.test.js.map +1 -0
- package/lib/plugins/picklists/field-dependencies/pages.d.ts +15 -0
- package/lib/plugins/picklists/field-dependencies/pages.js +50 -0
- package/lib/plugins/picklists/field-dependencies/pages.js.map +1 -0
- package/lib/plugins/picklists/index.d.ts +23 -0
- package/lib/plugins/picklists/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/picklists/index.e2e-spec.js +128 -0
- package/lib/plugins/picklists/index.e2e-spec.js.map +1 -0
- package/lib/plugins/picklists/index.js +229 -0
- package/lib/plugins/picklists/index.js.map +1 -0
- package/lib/plugins/picklists/pages.d.ts +45 -0
- package/lib/plugins/picklists/pages.js +185 -0
- package/lib/plugins/picklists/pages.js.map +1 -0
- package/lib/plugins/picklists/standard-value-set.d.ts +1 -0
- package/lib/plugins/picklists/standard-value-set.js +80 -0
- package/lib/plugins/picklists/standard-value-set.js.map +1 -0
- package/lib/plugins/record-types/index.d.ts +14 -0
- package/lib/plugins/record-types/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/record-types/index.e2e-spec.js +76 -0
- package/lib/plugins/record-types/index.e2e-spec.js.map +1 -0
- package/lib/plugins/record-types/index.js +133 -0
- package/lib/plugins/record-types/index.js.map +1 -0
- package/lib/plugins/record-types/pages.d.ts +14 -0
- package/lib/plugins/record-types/pages.js +50 -0
- package/lib/plugins/record-types/pages.js.map +1 -0
- package/lib/plugins/relate-contact-to-multiple-accounts/index.d.ts +11 -0
- package/lib/plugins/relate-contact-to-multiple-accounts/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/relate-contact-to-multiple-accounts/index.e2e-spec.js +30 -0
- package/lib/plugins/relate-contact-to-multiple-accounts/index.e2e-spec.js.map +1 -0
- package/lib/plugins/relate-contact-to-multiple-accounts/index.js +120 -0
- package/lib/plugins/relate-contact-to-multiple-accounts/index.js.map +1 -0
- package/lib/plugins/reports-and-dashboards/folder-sharing/index.d.ts +8 -0
- package/lib/plugins/reports-and-dashboards/folder-sharing/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/reports-and-dashboards/folder-sharing/index.e2e-spec.js +3 -0
- package/lib/plugins/reports-and-dashboards/folder-sharing/index.e2e-spec.js.map +1 -0
- package/lib/plugins/reports-and-dashboards/folder-sharing/index.js +116 -0
- package/lib/plugins/reports-and-dashboards/folder-sharing/index.js.map +1 -0
- package/lib/plugins/reports-and-dashboards/index.d.ts +11 -0
- package/lib/plugins/reports-and-dashboards/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/reports-and-dashboards/index.e2e-spec.js +3 -0
- package/lib/plugins/reports-and-dashboards/index.e2e-spec.js.map +1 -0
- package/lib/plugins/reports-and-dashboards/index.js +29 -0
- package/lib/plugins/reports-and-dashboards/index.js.map +1 -0
- package/lib/plugins/salesforce-cpq-config/formConfig.d.ts +17 -0
- package/lib/plugins/salesforce-cpq-config/formConfig.js +649 -0
- package/lib/plugins/salesforce-cpq-config/formConfig.js.map +1 -0
- package/lib/plugins/salesforce-cpq-config/index.d.ts +7 -0
- package/lib/plugins/salesforce-cpq-config/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/salesforce-cpq-config/index.e2e-spec.js +37 -0
- package/lib/plugins/salesforce-cpq-config/index.e2e-spec.js.map +1 -0
- package/lib/plugins/salesforce-cpq-config/index.js +261 -0
- package/lib/plugins/salesforce-cpq-config/index.js.map +1 -0
- package/lib/plugins/salesforce-to-salesforce/index.d.ts +9 -0
- package/lib/plugins/salesforce-to-salesforce/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/salesforce-to-salesforce/index.e2e-spec.js +34 -0
- package/lib/plugins/salesforce-to-salesforce/index.e2e-spec.js.map +1 -0
- package/lib/plugins/salesforce-to-salesforce/index.js +107 -0
- package/lib/plugins/salesforce-to-salesforce/index.js.map +1 -0
- package/lib/plugins/scheduled-batches/index.d.ts +10 -0
- package/lib/plugins/scheduled-batches/index.js +145 -0
- package/lib/plugins/scheduled-batches/index.js.map +1 -0
- package/lib/plugins/scheduled-batches/page.d.ts +19 -0
- package/lib/plugins/scheduled-batches/page.js +39 -0
- package/lib/plugins/scheduled-batches/page.js.map +1 -0
- package/lib/plugins/security/authentication-configuration/index.d.ts +15 -0
- package/lib/plugins/security/authentication-configuration/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/security/authentication-configuration/index.e2e-spec.js +129 -0
- package/lib/plugins/security/authentication-configuration/index.e2e-spec.js.map +1 -0
- package/lib/plugins/security/authentication-configuration/index.js +200 -0
- package/lib/plugins/security/authentication-configuration/index.js.map +1 -0
- package/lib/plugins/security/certificate-and-key-management/index.d.ts +23 -0
- package/lib/plugins/security/certificate-and-key-management/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/security/certificate-and-key-management/index.e2e-spec.js +59 -0
- package/lib/plugins/security/certificate-and-key-management/index.e2e-spec.js.map +1 -0
- package/lib/plugins/security/certificate-and-key-management/index.js +233 -0
- package/lib/plugins/security/certificate-and-key-management/index.js.map +1 -0
- package/lib/plugins/security/certificate-and-key-management/index.test.d.ts +1 -0
- package/lib/plugins/security/certificate-and-key-management/index.test.js +61 -0
- package/lib/plugins/security/certificate-and-key-management/index.test.js.map +1 -0
- package/lib/plugins/security/index.d.ts +13 -0
- package/lib/plugins/security/index.js +41 -0
- package/lib/plugins/security/index.js.map +1 -0
- package/lib/plugins/service-channels/capacity/index.d.ts +18 -0
- package/lib/plugins/service-channels/capacity/index.js +194 -0
- package/lib/plugins/service-channels/capacity/index.js.map +1 -0
- package/lib/plugins/service-channels/index.d.ts +12 -0
- package/lib/plugins/service-channels/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/service-channels/index.e2e-spec.js +67 -0
- package/lib/plugins/service-channels/index.e2e-spec.js.map +1 -0
- package/lib/plugins/service-channels/index.js +37 -0
- package/lib/plugins/service-channels/index.js.map +1 -0
- package/lib/plugins/slack/index.d.ts +9 -0
- package/lib/plugins/slack/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/slack/index.e2e-spec.js +47 -0
- package/lib/plugins/slack/index.e2e-spec.js.map +1 -0
- package/lib/plugins/slack/index.js +111 -0
- package/lib/plugins/slack/index.js.map +1 -0
- package/lib/plugins/user-access-policies/index.d.ts +19 -0
- package/lib/plugins/user-access-policies/index.e2e-spec.d.ts +1 -0
- package/lib/plugins/user-access-policies/index.e2e-spec.js +61 -0
- package/lib/plugins/user-access-policies/index.e2e-spec.js.map +1 -0
- package/lib/plugins/user-access-policies/index.js +176 -0
- package/lib/plugins/user-access-policies/index.js.map +1 -0
- package/lib/plugins/user-access-policies/page.d.ts +30 -0
- package/lib/plugins/user-access-policies/page.js +114 -0
- package/lib/plugins/user-access-policies/page.js.map +1 -0
- package/lib/plugins/utils.d.ts +13 -0
- package/lib/plugins/utils.js +159 -0
- package/lib/plugins/utils.js.map +1 -0
- package/oclif.manifest.json +177 -0
- package/package.json +65 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
2
|
+
if (value !== null && value !== void 0) {
|
|
3
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
4
|
+
var dispose, inner;
|
|
5
|
+
if (async) {
|
|
6
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
7
|
+
dispose = value[Symbol.asyncDispose];
|
|
8
|
+
}
|
|
9
|
+
if (dispose === void 0) {
|
|
10
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
11
|
+
dispose = value[Symbol.dispose];
|
|
12
|
+
if (async) inner = dispose;
|
|
13
|
+
}
|
|
14
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
15
|
+
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
16
|
+
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
17
|
+
}
|
|
18
|
+
else if (async) {
|
|
19
|
+
env.stack.push({ async: true });
|
|
20
|
+
}
|
|
21
|
+
return value;
|
|
22
|
+
};
|
|
23
|
+
var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
|
|
24
|
+
return function (env) {
|
|
25
|
+
function fail(e) {
|
|
26
|
+
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
27
|
+
env.hasError = true;
|
|
28
|
+
}
|
|
29
|
+
var r, s = 0;
|
|
30
|
+
function next() {
|
|
31
|
+
while (r = env.stack.pop()) {
|
|
32
|
+
try {
|
|
33
|
+
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
34
|
+
if (r.dispose) {
|
|
35
|
+
var result = r.dispose.call(r.value);
|
|
36
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
37
|
+
}
|
|
38
|
+
else s |= 1;
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
fail(e);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
45
|
+
if (env.hasError) throw env.error;
|
|
46
|
+
}
|
|
47
|
+
return next();
|
|
48
|
+
};
|
|
49
|
+
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
50
|
+
var e = new Error(message);
|
|
51
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
52
|
+
});
|
|
53
|
+
import { existsSync } from 'fs';
|
|
54
|
+
import * as path from 'path';
|
|
55
|
+
import * as queryString from 'querystring';
|
|
56
|
+
import { waitForPageErrors } from '../../../browserforce.js';
|
|
57
|
+
import { BrowserforcePlugin } from '../../../plugin.js';
|
|
58
|
+
const CERT_PREFIX_PATH = '/0P1';
|
|
59
|
+
const KEYSTORE_IMPORT_PATH = `/_ui/security/certificate/KeyStoreImportUi/e?retURL=${encodeURIComponent('/setup/forcecomHomepage.apexp')}`;
|
|
60
|
+
const FILE_UPLOAD_SELECTOR = 'input[type="file"]';
|
|
61
|
+
const KEYSTORE_PASSWORD_SELECTOR = 'input#Password';
|
|
62
|
+
const SAVE_BUTTON_SELECTOR = 'input[name="save"]';
|
|
63
|
+
export class CertificateAndKeyManagement extends BrowserforcePlugin {
|
|
64
|
+
async retrieve(definition) {
|
|
65
|
+
const response = {
|
|
66
|
+
certificates: [],
|
|
67
|
+
importFromKeystore: [],
|
|
68
|
+
};
|
|
69
|
+
let existingCertificates = [];
|
|
70
|
+
if (definition?.certificates?.length || definition?.importFromKeystore?.length) {
|
|
71
|
+
existingCertificates = // Note: Unfortunately scanAll=false has no impact and returns deleted records.
|
|
72
|
+
// Workaround: Order by CreatedDate DESC to get the latest record first.
|
|
73
|
+
(await this.browserforce.connection.tooling.query(`SELECT Id, DeveloperName, MasterLabel, OptionsIsPrivateKeyExportable, KeySize FROM Certificate ORDER BY CreatedDate DESC`, { scanAll: false }))?.records;
|
|
74
|
+
}
|
|
75
|
+
if (definition?.certificates?.length) {
|
|
76
|
+
for (const cert of definition.certificates) {
|
|
77
|
+
const existingCert = existingCertificates.find((co) => co.DeveloperName === cert.name);
|
|
78
|
+
if (existingCert) {
|
|
79
|
+
response.certificates.push({
|
|
80
|
+
_id: existingCert.Id,
|
|
81
|
+
name: existingCert.DeveloperName,
|
|
82
|
+
label: existingCert.MasterLabel,
|
|
83
|
+
exportable: existingCert.OptionsIsPrivateKeyExportable,
|
|
84
|
+
keySize: existingCert.KeySize,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (definition?.importFromKeystore?.length) {
|
|
90
|
+
for (const cert of definition.importFromKeystore) {
|
|
91
|
+
const existingCert = existingCertificates.find((co) => co.DeveloperName === cert.name);
|
|
92
|
+
if (existingCert) {
|
|
93
|
+
response.importFromKeystore.push({
|
|
94
|
+
name: existingCert.DeveloperName,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return response;
|
|
100
|
+
}
|
|
101
|
+
diff(state, definition) {
|
|
102
|
+
const response = {};
|
|
103
|
+
if (state && definition && state.certificates && definition.certificates) {
|
|
104
|
+
for (const cert of definition.certificates) {
|
|
105
|
+
const existingCert = state.certificates.find((c) => c.name === cert.name);
|
|
106
|
+
if (existingCert) {
|
|
107
|
+
// copy id from state to definition to be retained and used
|
|
108
|
+
cert._id = existingCert._id;
|
|
109
|
+
}
|
|
110
|
+
const certDiff = super.diff(existingCert, cert);
|
|
111
|
+
if (certDiff !== undefined) {
|
|
112
|
+
if (!response.certificates) {
|
|
113
|
+
response.certificates = [];
|
|
114
|
+
}
|
|
115
|
+
response.certificates.push(certDiff);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (definition?.importFromKeystore?.length) {
|
|
120
|
+
const importFromKeystore = definition?.importFromKeystore?.filter((cert) => !state?.importFromKeystore?.find((c) => c.name === cert.name));
|
|
121
|
+
if (importFromKeystore.length) {
|
|
122
|
+
response.importFromKeystore = importFromKeystore;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return Object.keys(response).length ? response : undefined;
|
|
126
|
+
}
|
|
127
|
+
async apply(plan) {
|
|
128
|
+
if (plan.certificates) {
|
|
129
|
+
for (const certificate of plan.certificates) {
|
|
130
|
+
if (certificate._id) {
|
|
131
|
+
// update
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
135
|
+
try {
|
|
136
|
+
// create new
|
|
137
|
+
const urlAttributes = {
|
|
138
|
+
DeveloperName: certificate.name,
|
|
139
|
+
MasterLabel: certificate.label,
|
|
140
|
+
};
|
|
141
|
+
if (certificate.keySize) {
|
|
142
|
+
urlAttributes['keySize'] = certificate.keySize;
|
|
143
|
+
}
|
|
144
|
+
if (certificate.exportable !== undefined) {
|
|
145
|
+
urlAttributes['exp'] = certificate.exportable ? 1 : 0;
|
|
146
|
+
}
|
|
147
|
+
const page = __addDisposableResource(env_1, await this.browserforce.openPage(`${CERT_PREFIX_PATH}/e?${queryString.stringify(urlAttributes)}`), true);
|
|
148
|
+
await page.locator(SAVE_BUTTON_SELECTOR).first().click();
|
|
149
|
+
// -> id (15 character Salesforce ID starting with 0P1)
|
|
150
|
+
await page.waitForURL((url) => /\/0P1\w{12}/.test(url.pathname));
|
|
151
|
+
}
|
|
152
|
+
catch (e_1) {
|
|
153
|
+
env_1.error = e_1;
|
|
154
|
+
env_1.hasError = true;
|
|
155
|
+
}
|
|
156
|
+
finally {
|
|
157
|
+
const result_1 = __disposeResources(env_1);
|
|
158
|
+
if (result_1)
|
|
159
|
+
await result_1;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (plan.importFromKeystore) {
|
|
165
|
+
for (const certificate of plan.importFromKeystore) {
|
|
166
|
+
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
167
|
+
try {
|
|
168
|
+
if (!certificate.filePath) {
|
|
169
|
+
throw new Error(`To import a certificate, the filePath is mandatory.`);
|
|
170
|
+
}
|
|
171
|
+
const filePath = path.resolve(certificate.filePath);
|
|
172
|
+
if (!existsSync(filePath)) {
|
|
173
|
+
throw new Error(`file does not exist: ${filePath}`);
|
|
174
|
+
}
|
|
175
|
+
const page = __addDisposableResource(env_2, await this.browserforce.openPage(KEYSTORE_IMPORT_PATH), true);
|
|
176
|
+
await page.locator(FILE_UPLOAD_SELECTOR).setInputFiles(filePath);
|
|
177
|
+
if (certificate.password) {
|
|
178
|
+
await page.locator(KEYSTORE_PASSWORD_SELECTOR).fill(certificate.password);
|
|
179
|
+
}
|
|
180
|
+
await page.locator(SAVE_BUTTON_SELECTOR).first().click();
|
|
181
|
+
await Promise.race([
|
|
182
|
+
page.waitForURL((url) => url.pathname === '/setup/forcecomHomepage.apexp'),
|
|
183
|
+
(async () => {
|
|
184
|
+
try {
|
|
185
|
+
await waitForPageErrors(page);
|
|
186
|
+
}
|
|
187
|
+
catch (e) {
|
|
188
|
+
if (e instanceof Error && e.message === 'Data Not Available') {
|
|
189
|
+
throw new Error('Failed to import certificate from Keystore. Please enable Identity Provider first. https://salesforce.stackexchange.com/questions/61618/import-keystore-in-certificate-and-key-management');
|
|
190
|
+
}
|
|
191
|
+
throw e;
|
|
192
|
+
}
|
|
193
|
+
})(),
|
|
194
|
+
]);
|
|
195
|
+
if (certificate.name) {
|
|
196
|
+
const env_3 = { stack: [], error: void 0, hasError: false };
|
|
197
|
+
try {
|
|
198
|
+
// rename cert as it has the wrong name
|
|
199
|
+
// JKS aliases are case-insensitive (and so lowercase)
|
|
200
|
+
const certsResponse = await this.browserforce.connection.tooling.query(`SELECT Id FROM Certificate WHERE DeveloperName = '${certificate.name.toLowerCase()}'`);
|
|
201
|
+
const importedCert = certsResponse.records[0];
|
|
202
|
+
const certPage = __addDisposableResource(env_3, await this.browserforce.openPage(`/${importedCert.Id}/e?MasterLabel=${certificate.name}&DeveloperName=${certificate.name}&retURL=${encodeURIComponent('/setup/forcecomHomepage.apexp')}`), true);
|
|
203
|
+
await certPage.locator(SAVE_BUTTON_SELECTOR).first().click();
|
|
204
|
+
await Promise.race([
|
|
205
|
+
await page.waitForURL((url) => url.pathname === '/setup/forcecomHomepage.apexp'),
|
|
206
|
+
waitForPageErrors(certPage),
|
|
207
|
+
]);
|
|
208
|
+
}
|
|
209
|
+
catch (e_2) {
|
|
210
|
+
env_3.error = e_2;
|
|
211
|
+
env_3.hasError = true;
|
|
212
|
+
}
|
|
213
|
+
finally {
|
|
214
|
+
const result_2 = __disposeResources(env_3);
|
|
215
|
+
if (result_2)
|
|
216
|
+
await result_2;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
catch (e_3) {
|
|
221
|
+
env_2.error = e_3;
|
|
222
|
+
env_2.hasError = true;
|
|
223
|
+
}
|
|
224
|
+
finally {
|
|
225
|
+
const result_3 = __disposeResources(env_2);
|
|
226
|
+
if (result_3)
|
|
227
|
+
await result_3;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugins/security/certificate-and-key-management/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,WAAW,MAAM,aAAa,CAAC;AAC3C,OAAO,EAA0B,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAChC,MAAM,oBAAoB,GAAsB,uDAAuD,kBAAkB,CAAC,+BAA+B,CAAC,EAAE,CAAC;AAE7J,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AAClD,MAAM,0BAA0B,GAAG,gBAAgB,CAAC;AACpD,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AA4BlD,MAAM,OAAO,2BAA4B,SAAQ,kBAAkB;IAC1D,KAAK,CAAC,QAAQ,CAAC,UAAkB;QACtC,MAAM,QAAQ,GAAW;YACvB,YAAY,EAAE,EAAE;YAChB,kBAAkB,EAAE,EAAE;SACvB,CAAC;QACF,IAAI,oBAAoB,GAAwB,EAAE,CAAC;QACnD,IAAI,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,UAAU,EAAE,kBAAkB,EAAE,MAAM,EAAE,CAAC;YAC/E,oBAAoB,GAAG,+EAA+E;gBACpG,wEAA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CACJ,CAAC;gCACD,MAAM,CAAC,CAAC;4BACV,CAAC;wBACH,CAAC,CAAC,EAAE;qBACL,CAAC,CAAC;oBACH,IAAI,WAAW,CAAC,IAAI,EAAE,CAAC;;;4BACrB,uCAAuC;4BACvC,uDAAuD;4BACvD,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CACpE,qDAAqD,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,CACvF,CAAC;4BACF,MAAM,YAAY,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;4BAC9C,MAAY,QAAQ,kCAAG,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CACrD,IAAI,YAAY,CAAC,EAAE,kBAAkB,WAAW,CAAC,IAAI,kBAAkB,WAAW,CAAC,IAAI,WAAW,kBAAkB,CAAC,+BAA+B,CAAC,EAAE,CACxJ,OAAA,CAAC;4BACF,MAAM,QAAQ,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC;4BAC7D,MAAM,OAAO,CAAC,IAAI,CAAC;gCACjB,MAAM,IAAI,CAAC,UAAU,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,KAAK,+BAA+B,CAAC;gCAChF,iBAAiB,CAAC,QAAQ,CAAC;6BAC5B,CAAC,CAAC;;;;;;;;;;;qBACJ;;;;;;;;;;;aACF;QACH,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import assert from 'assert';
|
|
2
|
+
import { CertificateAndKeyManagement } from './index.js';
|
|
3
|
+
const tests = [
|
|
4
|
+
{
|
|
5
|
+
description: 'should not do anything if keystore already exists',
|
|
6
|
+
source: {
|
|
7
|
+
importFromKeystore: [
|
|
8
|
+
{
|
|
9
|
+
name: 'Dummy',
|
|
10
|
+
},
|
|
11
|
+
],
|
|
12
|
+
},
|
|
13
|
+
target: {
|
|
14
|
+
importFromKeystore: [
|
|
15
|
+
{
|
|
16
|
+
name: 'Dummy',
|
|
17
|
+
filePath: 'foo.jks',
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
expected: undefined,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
description: 'should try to import keystore',
|
|
25
|
+
source: {
|
|
26
|
+
importFromKeystore: [
|
|
27
|
+
{
|
|
28
|
+
name: 'Foo',
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
target: {
|
|
33
|
+
importFromKeystore: [
|
|
34
|
+
{
|
|
35
|
+
name: 'Dummy',
|
|
36
|
+
filePath: 'foo.jks',
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
expected: {
|
|
41
|
+
importFromKeystore: [
|
|
42
|
+
{
|
|
43
|
+
name: 'Dummy',
|
|
44
|
+
filePath: 'foo.jks',
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
describe('CertificateAndKeyManagement', () => {
|
|
51
|
+
describe('diff()', () => {
|
|
52
|
+
const p = new CertificateAndKeyManagement(global.browserforce);
|
|
53
|
+
for (const t of tests) {
|
|
54
|
+
it(t.description, () => {
|
|
55
|
+
const actual = p.diff(t.source, t.target);
|
|
56
|
+
assert.deepStrictEqual(actual, t.expected);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=index.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../../src/plugins/security/certificate-and-key-management/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,2BAA2B,EAAU,M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lugin } from '../../plugin.js';
|
|
2
|
+
import { Config as AuthenticationConfigurationConfig } from './authentication-configuration/index.js';
|
|
3
|
+
import { Config as CertificateAndKeyManagementConfig } from './certificate-and-key-management/index.js';
|
|
4
|
+
type Config = {
|
|
5
|
+
certificateAndKeyManagement?: CertificateAndKeyManagementConfig;
|
|
6
|
+
authenticationConfiguration?: AuthenticationConfigurationConfig;
|
|
7
|
+
};
|
|
8
|
+
export declare class Security extends BrowserforcePlugin {
|
|
9
|
+
retrieve(definition?: Config): Promise<Config>;
|
|
10
|
+
diff(state: Config, definition: Config): Config | undefined;
|
|
11
|
+
apply(plan: Config): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { BrowserforcePlugin } from '../../plugin.js';
|
|
2
|
+
import { AuthenticationConfiguration, } from './authentication-configuration/index.js';
|
|
3
|
+
import { CertificateAndKeyManagement, } from './certificate-and-key-management/index.js';
|
|
4
|
+
export class Security extends BrowserforcePlugin {
|
|
5
|
+
async retrieve(definition) {
|
|
6
|
+
const response = {};
|
|
7
|
+
if (definition) {
|
|
8
|
+
if (definition.certificateAndKeyManagement) {
|
|
9
|
+
const pluginCKM = new CertificateAndKeyManagement(this.browserforce);
|
|
10
|
+
response.certificateAndKeyManagement = await pluginCKM.retrieve(definition.certificateAndKeyManagement);
|
|
11
|
+
}
|
|
12
|
+
if (definition.authenticationConfiguration) {
|
|
13
|
+
response.authenticationConfiguration = await new AuthenticationConfiguration(this.browserforce).retrieve(definition.authenticationConfiguration);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return response;
|
|
17
|
+
}
|
|
18
|
+
diff(state, definition) {
|
|
19
|
+
const certificateAndKeyManagement = new CertificateAndKeyManagement(this.browserforce).diff(state.certificateAndKeyManagement, definition.certificateAndKeyManagement);
|
|
20
|
+
const authenticationConfiguration = new AuthenticationConfiguration(this.browserforce).diff(state.authenticationConfiguration, definition.authenticationConfiguration);
|
|
21
|
+
const response = {};
|
|
22
|
+
if (certificateAndKeyManagement !== undefined) {
|
|
23
|
+
response.certificateAndKeyManagement = certificateAndKeyManagement;
|
|
24
|
+
}
|
|
25
|
+
if (authenticationConfiguration !== undefined) {
|
|
26
|
+
response.authenticationConfiguration = authenticationConfiguration;
|
|
27
|
+
}
|
|
28
|
+
return Object.keys(response).length ? response : undefined;
|
|
29
|
+
}
|
|
30
|
+
async apply(plan) {
|
|
31
|
+
if (plan.certificateAndKeyManagement) {
|
|
32
|
+
const pluginCKM = new CertificateAndKeyManagement(this.browserforce);
|
|
33
|
+
await pluginCKM.apply(plan.certificateAndKeyManagement);
|
|
34
|
+
}
|
|
35
|
+
if (plan.authenticationConfiguration) {
|
|
36
|
+
const pluginAuthConfig = new AuthenticationConfiguration(this.browserforce);
|
|
37
|
+
await pluginAuthConfig.apply(plan.authenticationConfiguration);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/security/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EACL,2BAA2B,GAE5B,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,2BAA2B,GAE5B,MAAM,2CAA2C,CAAC;AAOnD,MAAM,OAAO,QAAS,SAAQ,kBAAkB;IACvC,KAAK,CAAC,QAAQ,CAAC,UAAmB;QACvC,MAAM,QAAQ,GAAW,EAAE,CAAC;QAC5B,IAAI,UAAU,EAAE,CAAC;YACf,IAAI,UAAU,CAAC,2BAA2B,EAAE,CAAC;gBAC3C,MAAM,SAAS,GAAG,IAAI,2BAA2B,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;gBACrE,QAAQ,CAAC,2BAA2B,GAAG,MAAM,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,2BAA2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,CAAC,2BAA2B,EAAE,CAAC;YACrC,MAAM,gBAAgB,GAAG,IAAI,2BAA2B,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAC5E,MAAM,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BrowserforcePlugin } from '../../../plugin.js';
|
|
2
|
+
type ServiceChannel = {
|
|
3
|
+
serviceChannelDeveloperName: string;
|
|
4
|
+
capacity: CapacityConfig;
|
|
5
|
+
};
|
|
6
|
+
export type CapacityConfig = {
|
|
7
|
+
capacityModel?: string;
|
|
8
|
+
statusField?: string;
|
|
9
|
+
valuesForInProgress?: string[];
|
|
10
|
+
checkAgentCapacityOnReopenedWorkItems?: boolean;
|
|
11
|
+
checkAgentCapacityOnReassignedWorkItems?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare class Capacity extends BrowserforcePlugin {
|
|
14
|
+
retrieve(definition: ServiceChannel): Promise<CapacityConfig>;
|
|
15
|
+
diff(state?: CapacityConfig, definition?: CapacityConfig): CapacityConfig | undefined;
|
|
16
|
+
apply(config: ServiceChannel): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
2
|
+
if (value !== null && value !== void 0) {
|
|
3
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
4
|
+
var dispose, inner;
|
|
5
|
+
if (async) {
|
|
6
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
7
|
+
dispose = value[Symbol.asyncDispose];
|
|
8
|
+
}
|
|
9
|
+
if (dispose === void 0) {
|
|
10
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
11
|
+
dispose = value[Symbol.dispose];
|
|
12
|
+
if (async) inner = dispose;
|
|
13
|
+
}
|
|
14
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
15
|
+
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
16
|
+
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
17
|
+
}
|
|
18
|
+
else if (async) {
|
|
19
|
+
env.stack.push({ async: true });
|
|
20
|
+
}
|
|
21
|
+
return value;
|
|
22
|
+
};
|
|
23
|
+
var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
|
|
24
|
+
return function (env) {
|
|
25
|
+
function fail(e) {
|
|
26
|
+
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
27
|
+
env.hasError = true;
|
|
28
|
+
}
|
|
29
|
+
var r, s = 0;
|
|
30
|
+
function next() {
|
|
31
|
+
while (r = env.stack.pop()) {
|
|
32
|
+
try {
|
|
33
|
+
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
34
|
+
if (r.dispose) {
|
|
35
|
+
var result = r.dispose.call(r.value);
|
|
36
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
37
|
+
}
|
|
38
|
+
else s |= 1;
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
fail(e);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
45
|
+
if (env.hasError) throw env.error;
|
|
46
|
+
}
|
|
47
|
+
return next();
|
|
48
|
+
};
|
|
49
|
+
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
50
|
+
var e = new Error(message);
|
|
51
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
52
|
+
});
|
|
53
|
+
import { waitForPageErrors } from '../../../browserforce.js';
|
|
54
|
+
import { BrowserforcePlugin } from '../../../plugin.js';
|
|
55
|
+
const ADD_BUTTON_SELECTOR = 'a[id$=":duelingListBox:backingList_add"]';
|
|
56
|
+
const CAPACITY_MODEL_SELECTOR = 'select[id$=":capacityModelSection:editCapacityModel"]';
|
|
57
|
+
const OWNER_CHANGE_CAPACITY_SELECTOR = 'input[name*=":ownerChangeCapacityCheck"]';
|
|
58
|
+
const REMOVE_BUTTON_SELECTOR = 'a[id$=":duelingListBox:backingList_remove"]';
|
|
59
|
+
const SAVE_BUTTON_SELECTOR = 'input[id$=":save"]';
|
|
60
|
+
const STATUS_FIELD_SELECTOR = 'select[id$=":statusFieldSection:editCapacityModel"]';
|
|
61
|
+
const STATUS_CHANGE_CAPACITY_SELECTOR = 'input[name*=":statusChangeCapacityCheck"]';
|
|
62
|
+
const VALUES_COMPLETED_SELECTOR = 'select[id$=":statusFieldValues:duelingListBox:backingList_a"]';
|
|
63
|
+
const VALUES_IN_PROGRESS_SELECTOR = 'select[id$=":statusFieldValues:duelingListBox:backingList_s"]';
|
|
64
|
+
export class Capacity extends BrowserforcePlugin {
|
|
65
|
+
async retrieve(definition) {
|
|
66
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
67
|
+
try {
|
|
68
|
+
// Query for the service channel
|
|
69
|
+
const serviceChannelDeveloperName = definition.serviceChannelDeveloperName;
|
|
70
|
+
const serviceChannel = await this.browserforce.connection.singleRecordQuery(`SELECT Id FROM ServiceChannel WHERE DeveloperName='${serviceChannelDeveloperName}'`);
|
|
71
|
+
// Open the service channel setup page
|
|
72
|
+
const page = __addDisposableResource(env_1, await this.browserforce.openPage(`/${serviceChannel.Id}/e`), true);
|
|
73
|
+
// Retrieve the service channel config
|
|
74
|
+
const capacityModelCount = await page.locator(CAPACITY_MODEL_SELECTOR).count();
|
|
75
|
+
if (capacityModelCount === 0) {
|
|
76
|
+
return {};
|
|
77
|
+
}
|
|
78
|
+
const capacityModel = await page.locator(`${CAPACITY_MODEL_SELECTOR}`).inputValue();
|
|
79
|
+
if (capacityModel === 'StatusBased') {
|
|
80
|
+
const statusField = await page.locator(`${STATUS_FIELD_SELECTOR}`).inputValue();
|
|
81
|
+
const inProgressOptionsLocator = page.locator(VALUES_IN_PROGRESS_SELECTOR).locator('option:not(:disabled)');
|
|
82
|
+
const valuesForInProgress = await Promise.all((await inProgressOptionsLocator.all()).map((option) => option.getAttribute('title')));
|
|
83
|
+
const checkAgentCapacityOnReopenedWorkItems = await page.locator(STATUS_CHANGE_CAPACITY_SELECTOR).isChecked();
|
|
84
|
+
const checkAgentCapacityOnReassignedWorkItems = await page.locator(OWNER_CHANGE_CAPACITY_SELECTOR).isChecked();
|
|
85
|
+
return {
|
|
86
|
+
capacityModel,
|
|
87
|
+
statusField,
|
|
88
|
+
valuesForInProgress,
|
|
89
|
+
checkAgentCapacityOnReopenedWorkItems,
|
|
90
|
+
checkAgentCapacityOnReassignedWorkItems,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
return { capacityModel };
|
|
94
|
+
}
|
|
95
|
+
catch (e_1) {
|
|
96
|
+
env_1.error = e_1;
|
|
97
|
+
env_1.hasError = true;
|
|
98
|
+
}
|
|
99
|
+
finally {
|
|
100
|
+
const result_1 = __disposeResources(env_1);
|
|
101
|
+
if (result_1)
|
|
102
|
+
await result_1;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
diff(state, definition) {
|
|
106
|
+
const response = {};
|
|
107
|
+
if (state && definition) {
|
|
108
|
+
if (definition.capacityModel === 'Tab-based') {
|
|
109
|
+
if (definition.capacityModel !== state.capacityModel) {
|
|
110
|
+
response.capacityModel = definition.capacityModel;
|
|
111
|
+
return response;
|
|
112
|
+
}
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
if (definition.capacityModel !== state.capacityModel) {
|
|
116
|
+
response.capacityModel = definition.capacityModel;
|
|
117
|
+
}
|
|
118
|
+
if (definition.statusField !== state.statusField) {
|
|
119
|
+
response.statusField = definition.statusField;
|
|
120
|
+
}
|
|
121
|
+
if (JSON.stringify(definition.valuesForInProgress) !== JSON.stringify(state.valuesForInProgress)) {
|
|
122
|
+
response.valuesForInProgress = definition.valuesForInProgress;
|
|
123
|
+
}
|
|
124
|
+
if (definition.checkAgentCapacityOnReassignedWorkItems !== state.checkAgentCapacityOnReassignedWorkItems) {
|
|
125
|
+
response.checkAgentCapacityOnReassignedWorkItems = definition.checkAgentCapacityOnReassignedWorkItems;
|
|
126
|
+
}
|
|
127
|
+
if (definition.checkAgentCapacityOnReopenedWorkItems !== state.checkAgentCapacityOnReopenedWorkItems) {
|
|
128
|
+
response.checkAgentCapacityOnReopenedWorkItems = definition.checkAgentCapacityOnReopenedWorkItems;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return Object.keys(response).length ? response : undefined;
|
|
132
|
+
}
|
|
133
|
+
async apply(config) {
|
|
134
|
+
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
135
|
+
try {
|
|
136
|
+
// Query for the service channel
|
|
137
|
+
const serviceChannelDeveloperName = config.serviceChannelDeveloperName;
|
|
138
|
+
const serviceChannel = await this.browserforce.connection.singleRecordQuery(`SELECT Id FROM ServiceChannel WHERE DeveloperName='${serviceChannelDeveloperName}'`);
|
|
139
|
+
// Open the service channel setup page
|
|
140
|
+
const page = __addDisposableResource(env_2, await this.browserforce.openPage(`/${serviceChannel.Id}/e`), true);
|
|
141
|
+
// Update the service channel config
|
|
142
|
+
const configCapacity = config.capacity;
|
|
143
|
+
if (configCapacity?.capacityModel) {
|
|
144
|
+
await page.locator(CAPACITY_MODEL_SELECTOR).selectOption(configCapacity.capacityModel);
|
|
145
|
+
}
|
|
146
|
+
if (configCapacity?.statusField) {
|
|
147
|
+
await page.locator(STATUS_FIELD_SELECTOR).selectOption(configCapacity.statusField);
|
|
148
|
+
}
|
|
149
|
+
// TODO: find another condition
|
|
150
|
+
await page.waitForLoadState('networkidle');
|
|
151
|
+
if (configCapacity?.valuesForInProgress) {
|
|
152
|
+
const completedOptionsLocator = page.locator(VALUES_COMPLETED_SELECTOR).locator('option:not(:disabled)');
|
|
153
|
+
const completedOptions = await Promise.all((await completedOptionsLocator.all()).map((option) => option.getAttribute('title')));
|
|
154
|
+
const inProgressOptionsLocator = page.locator(VALUES_IN_PROGRESS_SELECTOR).locator('option:not(:disabled)');
|
|
155
|
+
const inProgressOptions = await Promise.all((await inProgressOptionsLocator.all()).map((option) => option.getAttribute('title')));
|
|
156
|
+
for (const optionTitle of completedOptions) {
|
|
157
|
+
if (configCapacity.valuesForInProgress.includes(optionTitle)) {
|
|
158
|
+
await page.getByRole('option', { name: optionTitle, exact: true }).click();
|
|
159
|
+
await page.locator(ADD_BUTTON_SELECTOR).click();
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
for (const optionTitle of inProgressOptions) {
|
|
163
|
+
if (!configCapacity.valuesForInProgress.includes(optionTitle)) {
|
|
164
|
+
await page.getByRole('option', { name: optionTitle, exact: true }).click();
|
|
165
|
+
await page.locator(REMOVE_BUTTON_SELECTOR).click();
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (configCapacity?.checkAgentCapacityOnReassignedWorkItems !== undefined) {
|
|
170
|
+
await page
|
|
171
|
+
.locator(STATUS_CHANGE_CAPACITY_SELECTOR)
|
|
172
|
+
.setChecked(configCapacity.checkAgentCapacityOnReassignedWorkItems);
|
|
173
|
+
}
|
|
174
|
+
if (configCapacity?.checkAgentCapacityOnReopenedWorkItems !== undefined) {
|
|
175
|
+
await page
|
|
176
|
+
.locator(OWNER_CHANGE_CAPACITY_SELECTOR)
|
|
177
|
+
.setChecked(configCapacity.checkAgentCapacityOnReopenedWorkItems);
|
|
178
|
+
}
|
|
179
|
+
// Save the settings and wait for page refresh
|
|
180
|
+
await page.locator(SAVE_BUTTON_SELECTOR).first().click();
|
|
181
|
+
await Promise.race([page.waitForURL((url) => !url.pathname.endsWith('/e')), waitForPageErrors(page)]);
|
|
182
|
+
}
|
|
183
|
+
catch (e_2) {
|
|
184
|
+
env_2.error = e_2;
|
|
185
|
+
env_2.hasError = true;
|
|
186
|
+
}
|
|
187
|
+
finally {
|
|
188
|
+
const result_2 = __disposeResources(env_2);
|
|
189
|
+
if (result_2)
|
|
190
|
+
await result_2;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugins/service-channels/capacity/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,MAAM,mBAAmB,GAAG,0CAA0C,CAAC;AACvE,MAAM,uBAAuB,GAAG,uDAAuD,CAAC;AACxF,MAAM,8BAA8B,GAAG,0CAA0C,CAAC;AAClF,MAAM,sBAAsB,GAAG,6CAA6C,CAAC;AAC7E,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AAClD,MAAM,qBAAqB,GAAG,qDAAqD,CAAC;AACpF,MAAM,+BAA+B,GAAG,2CAA2C,CAAC;AACpF,MAAM,yBAAyB,GAAG,+DAA+D,CAAC;AAClG,MAAM,2BAA2B,GAAG,+DAA+D,CAAC;AAepG,MAAM,OAAO,QAAS,SAAQ,kBAAkB;IACvC,KAAK,CAAC,QAAQ,CAAC,UAA0B;;;YAC9C,gCAAgC;YAChC,MAAM,2BAA2B,GAAG,UAAU,CAAC,2BAA2B,CAAC;YAC3E,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,iBAAiB,CACzE,sDAAsD,2BAA2B,GAAG,CACrF,CAAC;YAEF,sCAAsC;YACtC,MAAY,IAAI,kCAAG,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,cAAc,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AAU,CAAC,cAAc,CAAC,qCAAqC,CAAC,CAAC;YACtE,CAAC;YAED,8CAA8C;YAC9C,MAAM,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC;YACzD,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;;;;;;;;;;;KACvG;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BrowserforcePlugin } from '../../plugin.js';
|
|
2
|
+
import { CapacityConfig } from './capacity/index.js';
|
|
3
|
+
type ServiceChannel = {
|
|
4
|
+
serviceChannelDeveloperName: string;
|
|
5
|
+
capacity: CapacityConfig;
|
|
6
|
+
};
|
|
7
|
+
export declare class ServiceChannels extends BrowserforcePlugin {
|
|
8
|
+
retrieve(definition?: ServiceChannel[]): Promise<ServiceChannel[]>;
|
|
9
|
+
diff(state: ServiceChannel[], definition: ServiceChannel[]): ServiceChannel[] | undefined;
|
|
10
|
+
apply(plan: ServiceChannel[]): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|