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.
Files changed (285) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +266 -0
  3. package/bin/run +9 -0
  4. package/bin/run.cmd +3 -0
  5. package/lib/browserforce-command.d.ts +27 -0
  6. package/lib/browserforce-command.js +162 -0
  7. package/lib/browserforce-command.js.map +1 -0
  8. package/lib/browserforce.d.ts +27 -0
  9. package/lib/browserforce.js +163 -0
  10. package/lib/browserforce.js.map +1 -0
  11. package/lib/commands/browserforce/apply.d.ts +10 -0
  12. package/lib/commands/browserforce/apply.js +83 -0
  13. package/lib/commands/browserforce/apply.js.map +1 -0
  14. package/lib/commands/browserforce/playwright.d.ts +9 -0
  15. package/lib/commands/browserforce/playwright.js +53 -0
  16. package/lib/commands/browserforce/playwright.js.map +1 -0
  17. package/lib/config-parser.d.ts +16 -0
  18. package/lib/config-parser.js +24 -0
  19. package/lib/config-parser.js.map +1 -0
  20. package/lib/index.d.ts +1 -0
  21. package/lib/index.js +2 -0
  22. package/lib/index.js.map +1 -0
  23. package/lib/jsforce-utils.d.ts +5 -0
  24. package/lib/jsforce-utils.js +14 -0
  25. package/lib/jsforce-utils.js.map +1 -0
  26. package/lib/pages/login.d.ts +7 -0
  27. package/lib/pages/login.js +17 -0
  28. package/lib/pages/login.js.map +1 -0
  29. package/lib/plugin.d.ts +15 -0
  30. package/lib/plugin.js +28 -0
  31. package/lib/plugin.js.map +1 -0
  32. package/lib/plugins/activity-settings/index.d.ts +9 -0
  33. package/lib/plugins/activity-settings/index.e2e-spec.d.ts +1 -0
  34. package/lib/plugins/activity-settings/index.e2e-spec.js +36 -0
  35. package/lib/plugins/activity-settings/index.e2e-spec.js.map +1 -0
  36. package/lib/plugins/activity-settings/index.js +102 -0
  37. package/lib/plugins/activity-settings/index.js.map +1 -0
  38. package/lib/plugins/auth-providers/index.d.ts +13 -0
  39. package/lib/plugins/auth-providers/index.e2e-spec.d.ts +1 -0
  40. package/lib/plugins/auth-providers/index.e2e-spec.js +78 -0
  41. package/lib/plugins/auth-providers/index.e2e-spec.js.map +1 -0
  42. package/lib/plugins/auth-providers/index.js +135 -0
  43. package/lib/plugins/auth-providers/index.js.map +1 -0
  44. package/lib/plugins/company-information/index.d.ts +8 -0
  45. package/lib/plugins/company-information/index.e2e-spec.d.ts +1 -0
  46. package/lib/plugins/company-information/index.e2e-spec.js +37 -0
  47. package/lib/plugins/company-information/index.e2e-spec.js.map +1 -0
  48. package/lib/plugins/company-information/index.js +114 -0
  49. package/lib/plugins/company-information/index.js.map +1 -0
  50. package/lib/plugins/customer-portal/available-custom-objects/index.d.ts +14 -0
  51. package/lib/plugins/customer-portal/available-custom-objects/index.js +203 -0
  52. package/lib/plugins/customer-portal/available-custom-objects/index.js.map +1 -0
  53. package/lib/plugins/customer-portal/available-custom-objects/index.test.d.ts +1 -0
  54. package/lib/plugins/customer-portal/available-custom-objects/index.test.js +39 -0
  55. package/lib/plugins/customer-portal/available-custom-objects/index.test.js.map +1 -0
  56. package/lib/plugins/customer-portal/enabled/index.d.ts +6 -0
  57. package/lib/plugins/customer-portal/enabled/index.js +89 -0
  58. package/lib/plugins/customer-portal/enabled/index.js.map +1 -0
  59. package/lib/plugins/customer-portal/enabled/index.test.d.ts +1 -0
  60. package/lib/plugins/customer-portal/enabled/index.test.js +34 -0
  61. package/lib/plugins/customer-portal/enabled/index.test.js.map +1 -0
  62. package/lib/plugins/customer-portal/index.d.ts +15 -0
  63. package/lib/plugins/customer-portal/index.e2e-spec.d.ts +1 -0
  64. package/lib/plugins/customer-portal/index.e2e-spec.js +188 -0
  65. package/lib/plugins/customer-portal/index.e2e-spec.js.map +1 -0
  66. package/lib/plugins/customer-portal/index.js +58 -0
  67. package/lib/plugins/customer-portal/index.js.map +1 -0
  68. package/lib/plugins/customer-portal/index.test.d.ts +1 -0
  69. package/lib/plugins/customer-portal/index.test.js +84 -0
  70. package/lib/plugins/customer-portal/index.test.js.map +1 -0
  71. package/lib/plugins/customer-portal/portals/index.d.ts +25 -0
  72. package/lib/plugins/customer-portal/portals/index.js +254 -0
  73. package/lib/plugins/customer-portal/portals/index.js.map +1 -0
  74. package/lib/plugins/customer-portal/portals/index.test.d.ts +1 -0
  75. package/lib/plugins/customer-portal/portals/index.test.js +140 -0
  76. package/lib/plugins/customer-portal/portals/index.test.js.map +1 -0
  77. package/lib/plugins/density-settings/index.d.ts +10 -0
  78. package/lib/plugins/density-settings/index.e2e-spec.d.ts +1 -0
  79. package/lib/plugins/density-settings/index.e2e-spec.js +39 -0
  80. package/lib/plugins/density-settings/index.e2e-spec.js.map +1 -0
  81. package/lib/plugins/density-settings/index.js +101 -0
  82. package/lib/plugins/density-settings/index.js.map +1 -0
  83. package/lib/plugins/deprecated.d.ts +4 -0
  84. package/lib/plugins/deprecated.js +28 -0
  85. package/lib/plugins/deprecated.js.map +1 -0
  86. package/lib/plugins/email-deliverability/index.d.ts +9 -0
  87. package/lib/plugins/email-deliverability/index.e2e-spec.d.ts +1 -0
  88. package/lib/plugins/email-deliverability/index.e2e-spec.js +55 -0
  89. package/lib/plugins/email-deliverability/index.e2e-spec.js.map +1 -0
  90. package/lib/plugins/email-deliverability/index.js +109 -0
  91. package/lib/plugins/email-deliverability/index.js.map +1 -0
  92. package/lib/plugins/high-velocity-sales-settings/index.d.ts +10 -0
  93. package/lib/plugins/high-velocity-sales-settings/index.e2e-spec.d.ts +1 -0
  94. package/lib/plugins/high-velocity-sales-settings/index.e2e-spec.js +29 -0
  95. package/lib/plugins/high-velocity-sales-settings/index.e2e-spec.js.map +1 -0
  96. package/lib/plugins/high-velocity-sales-settings/index.js +105 -0
  97. package/lib/plugins/high-velocity-sales-settings/index.js.map +1 -0
  98. package/lib/plugins/high-velocity-sales-settings/page.d.ts +8 -0
  99. package/lib/plugins/high-velocity-sales-settings/page.js +27 -0
  100. package/lib/plugins/high-velocity-sales-settings/page.js.map +1 -0
  101. package/lib/plugins/history-tracking/index.d.ts +19 -0
  102. package/lib/plugins/history-tracking/index.e2e-spec.d.ts +1 -0
  103. package/lib/plugins/history-tracking/index.e2e-spec.js +128 -0
  104. package/lib/plugins/history-tracking/index.e2e-spec.js.map +1 -0
  105. package/lib/plugins/history-tracking/index.js +272 -0
  106. package/lib/plugins/history-tracking/index.js.map +1 -0
  107. package/lib/plugins/home-page-layouts/index.d.ts +14 -0
  108. package/lib/plugins/home-page-layouts/index.e2e-spec.d.ts +1 -0
  109. package/lib/plugins/home-page-layouts/index.e2e-spec.js +47 -0
  110. package/lib/plugins/home-page-layouts/index.e2e-spec.js.map +1 -0
  111. package/lib/plugins/home-page-layouts/index.js +145 -0
  112. package/lib/plugins/home-page-layouts/index.js.map +1 -0
  113. package/lib/plugins/home-page-layouts/index.test.d.ts +1 -0
  114. package/lib/plugins/home-page-layouts/index.test.js +104 -0
  115. package/lib/plugins/home-page-layouts/index.test.js.map +1 -0
  116. package/lib/plugins/index.d.ts +28 -0
  117. package/lib/plugins/index.js +29 -0
  118. package/lib/plugins/index.js.map +1 -0
  119. package/lib/plugins/lightning-experience-settings/index.d.ts +17 -0
  120. package/lib/plugins/lightning-experience-settings/index.e2e-spec.d.ts +1 -0
  121. package/lib/plugins/lightning-experience-settings/index.e2e-spec.js +48 -0
  122. package/lib/plugins/lightning-experience-settings/index.e2e-spec.js.map +1 -0
  123. package/lib/plugins/lightning-experience-settings/index.js +149 -0
  124. package/lib/plugins/lightning-experience-settings/index.js.map +1 -0
  125. package/lib/plugins/linkedin-sales-navigator-settings/index.d.ts +8 -0
  126. package/lib/plugins/linkedin-sales-navigator-settings/index.e2e-spec.d.ts +1 -0
  127. package/lib/plugins/linkedin-sales-navigator-settings/index.e2e-spec.js +29 -0
  128. package/lib/plugins/linkedin-sales-navigator-settings/index.e2e-spec.js.map +1 -0
  129. package/lib/plugins/linkedin-sales-navigator-settings/index.js +93 -0
  130. package/lib/plugins/linkedin-sales-navigator-settings/index.js.map +1 -0
  131. package/lib/plugins/linkedin-sales-navigator-settings/page.d.ts +9 -0
  132. package/lib/plugins/linkedin-sales-navigator-settings/page.js +35 -0
  133. package/lib/plugins/linkedin-sales-navigator-settings/page.js.map +1 -0
  134. package/lib/plugins/login-as-user/index.d.ts +9 -0
  135. package/lib/plugins/login-as-user/index.js +104 -0
  136. package/lib/plugins/login-as-user/index.js.map +1 -0
  137. package/lib/plugins/logout-login-as-user/index.d.ts +6 -0
  138. package/lib/plugins/logout-login-as-user/index.js +76 -0
  139. package/lib/plugins/logout-login-as-user/index.js.map +1 -0
  140. package/lib/plugins/omni-channel-settings/index.d.ts +9 -0
  141. package/lib/plugins/omni-channel-settings/index.e2e-spec.d.ts +1 -0
  142. package/lib/plugins/omni-channel-settings/index.e2e-spec.js +30 -0
  143. package/lib/plugins/omni-channel-settings/index.e2e-spec.js.map +1 -0
  144. package/lib/plugins/omni-channel-settings/index.js +97 -0
  145. package/lib/plugins/omni-channel-settings/index.js.map +1 -0
  146. package/lib/plugins/opportunity-splits/index.d.ts +9 -0
  147. package/lib/plugins/opportunity-splits/index.e2e-spec.d.ts +1 -0
  148. package/lib/plugins/opportunity-splits/index.e2e-spec.js +46 -0
  149. package/lib/plugins/opportunity-splits/index.e2e-spec.js.map +1 -0
  150. package/lib/plugins/opportunity-splits/index.js +117 -0
  151. package/lib/plugins/opportunity-splits/index.js.map +1 -0
  152. package/lib/plugins/opportunity-splits/pages/layout-selection.d.ts +8 -0
  153. package/lib/plugins/opportunity-splits/pages/layout-selection.js +15 -0
  154. package/lib/plugins/opportunity-splits/pages/layout-selection.js.map +1 -0
  155. package/lib/plugins/opportunity-splits/pages/overview.d.ts +11 -0
  156. package/lib/plugins/opportunity-splits/pages/overview.js +32 -0
  157. package/lib/plugins/opportunity-splits/pages/overview.js.map +1 -0
  158. package/lib/plugins/opportunity-splits/pages/setup.d.ts +9 -0
  159. package/lib/plugins/opportunity-splits/pages/setup.js +17 -0
  160. package/lib/plugins/opportunity-splits/pages/setup.js.map +1 -0
  161. package/lib/plugins/permission-sets/index.d.ts +10 -0
  162. package/lib/plugins/permission-sets/index.e2e-spec.d.ts +1 -0
  163. package/lib/plugins/permission-sets/index.e2e-spec.js +47 -0
  164. package/lib/plugins/permission-sets/index.e2e-spec.js.map +1 -0
  165. package/lib/plugins/permission-sets/index.js +22 -0
  166. package/lib/plugins/permission-sets/index.js.map +1 -0
  167. package/lib/plugins/permission-sets/service-presence-status/index.d.ts +10 -0
  168. package/lib/plugins/permission-sets/service-presence-status/index.js +124 -0
  169. package/lib/plugins/permission-sets/service-presence-status/index.js.map +1 -0
  170. package/lib/plugins/picklists/field-dependencies/index.d.ts +11 -0
  171. package/lib/plugins/picklists/field-dependencies/index.js +133 -0
  172. package/lib/plugins/picklists/field-dependencies/index.js.map +1 -0
  173. package/lib/plugins/picklists/field-dependencies/index.test.d.ts +1 -0
  174. package/lib/plugins/picklists/field-dependencies/index.test.js +64 -0
  175. package/lib/plugins/picklists/field-dependencies/index.test.js.map +1 -0
  176. package/lib/plugins/picklists/field-dependencies/pages.d.ts +15 -0
  177. package/lib/plugins/picklists/field-dependencies/pages.js +50 -0
  178. package/lib/plugins/picklists/field-dependencies/pages.js.map +1 -0
  179. package/lib/plugins/picklists/index.d.ts +23 -0
  180. package/lib/plugins/picklists/index.e2e-spec.d.ts +1 -0
  181. package/lib/plugins/picklists/index.e2e-spec.js +128 -0
  182. package/lib/plugins/picklists/index.e2e-spec.js.map +1 -0
  183. package/lib/plugins/picklists/index.js +229 -0
  184. package/lib/plugins/picklists/index.js.map +1 -0
  185. package/lib/plugins/picklists/pages.d.ts +45 -0
  186. package/lib/plugins/picklists/pages.js +185 -0
  187. package/lib/plugins/picklists/pages.js.map +1 -0
  188. package/lib/plugins/picklists/standard-value-set.d.ts +1 -0
  189. package/lib/plugins/picklists/standard-value-set.js +80 -0
  190. package/lib/plugins/picklists/standard-value-set.js.map +1 -0
  191. package/lib/plugins/record-types/index.d.ts +14 -0
  192. package/lib/plugins/record-types/index.e2e-spec.d.ts +1 -0
  193. package/lib/plugins/record-types/index.e2e-spec.js +76 -0
  194. package/lib/plugins/record-types/index.e2e-spec.js.map +1 -0
  195. package/lib/plugins/record-types/index.js +133 -0
  196. package/lib/plugins/record-types/index.js.map +1 -0
  197. package/lib/plugins/record-types/pages.d.ts +14 -0
  198. package/lib/plugins/record-types/pages.js +50 -0
  199. package/lib/plugins/record-types/pages.js.map +1 -0
  200. package/lib/plugins/relate-contact-to-multiple-accounts/index.d.ts +11 -0
  201. package/lib/plugins/relate-contact-to-multiple-accounts/index.e2e-spec.d.ts +1 -0
  202. package/lib/plugins/relate-contact-to-multiple-accounts/index.e2e-spec.js +30 -0
  203. package/lib/plugins/relate-contact-to-multiple-accounts/index.e2e-spec.js.map +1 -0
  204. package/lib/plugins/relate-contact-to-multiple-accounts/index.js +120 -0
  205. package/lib/plugins/relate-contact-to-multiple-accounts/index.js.map +1 -0
  206. package/lib/plugins/reports-and-dashboards/folder-sharing/index.d.ts +8 -0
  207. package/lib/plugins/reports-and-dashboards/folder-sharing/index.e2e-spec.d.ts +1 -0
  208. package/lib/plugins/reports-and-dashboards/folder-sharing/index.e2e-spec.js +3 -0
  209. package/lib/plugins/reports-and-dashboards/folder-sharing/index.e2e-spec.js.map +1 -0
  210. package/lib/plugins/reports-and-dashboards/folder-sharing/index.js +116 -0
  211. package/lib/plugins/reports-and-dashboards/folder-sharing/index.js.map +1 -0
  212. package/lib/plugins/reports-and-dashboards/index.d.ts +11 -0
  213. package/lib/plugins/reports-and-dashboards/index.e2e-spec.d.ts +1 -0
  214. package/lib/plugins/reports-and-dashboards/index.e2e-spec.js +3 -0
  215. package/lib/plugins/reports-and-dashboards/index.e2e-spec.js.map +1 -0
  216. package/lib/plugins/reports-and-dashboards/index.js +29 -0
  217. package/lib/plugins/reports-and-dashboards/index.js.map +1 -0
  218. package/lib/plugins/salesforce-cpq-config/formConfig.d.ts +17 -0
  219. package/lib/plugins/salesforce-cpq-config/formConfig.js +649 -0
  220. package/lib/plugins/salesforce-cpq-config/formConfig.js.map +1 -0
  221. package/lib/plugins/salesforce-cpq-config/index.d.ts +7 -0
  222. package/lib/plugins/salesforce-cpq-config/index.e2e-spec.d.ts +1 -0
  223. package/lib/plugins/salesforce-cpq-config/index.e2e-spec.js +37 -0
  224. package/lib/plugins/salesforce-cpq-config/index.e2e-spec.js.map +1 -0
  225. package/lib/plugins/salesforce-cpq-config/index.js +261 -0
  226. package/lib/plugins/salesforce-cpq-config/index.js.map +1 -0
  227. package/lib/plugins/salesforce-to-salesforce/index.d.ts +9 -0
  228. package/lib/plugins/salesforce-to-salesforce/index.e2e-spec.d.ts +1 -0
  229. package/lib/plugins/salesforce-to-salesforce/index.e2e-spec.js +34 -0
  230. package/lib/plugins/salesforce-to-salesforce/index.e2e-spec.js.map +1 -0
  231. package/lib/plugins/salesforce-to-salesforce/index.js +107 -0
  232. package/lib/plugins/salesforce-to-salesforce/index.js.map +1 -0
  233. package/lib/plugins/scheduled-batches/index.d.ts +10 -0
  234. package/lib/plugins/scheduled-batches/index.js +145 -0
  235. package/lib/plugins/scheduled-batches/index.js.map +1 -0
  236. package/lib/plugins/scheduled-batches/page.d.ts +19 -0
  237. package/lib/plugins/scheduled-batches/page.js +39 -0
  238. package/lib/plugins/scheduled-batches/page.js.map +1 -0
  239. package/lib/plugins/security/authentication-configuration/index.d.ts +15 -0
  240. package/lib/plugins/security/authentication-configuration/index.e2e-spec.d.ts +1 -0
  241. package/lib/plugins/security/authentication-configuration/index.e2e-spec.js +129 -0
  242. package/lib/plugins/security/authentication-configuration/index.e2e-spec.js.map +1 -0
  243. package/lib/plugins/security/authentication-configuration/index.js +200 -0
  244. package/lib/plugins/security/authentication-configuration/index.js.map +1 -0
  245. package/lib/plugins/security/certificate-and-key-management/index.d.ts +23 -0
  246. package/lib/plugins/security/certificate-and-key-management/index.e2e-spec.d.ts +1 -0
  247. package/lib/plugins/security/certificate-and-key-management/index.e2e-spec.js +59 -0
  248. package/lib/plugins/security/certificate-and-key-management/index.e2e-spec.js.map +1 -0
  249. package/lib/plugins/security/certificate-and-key-management/index.js +233 -0
  250. package/lib/plugins/security/certificate-and-key-management/index.js.map +1 -0
  251. package/lib/plugins/security/certificate-and-key-management/index.test.d.ts +1 -0
  252. package/lib/plugins/security/certificate-and-key-management/index.test.js +61 -0
  253. package/lib/plugins/security/certificate-and-key-management/index.test.js.map +1 -0
  254. package/lib/plugins/security/index.d.ts +13 -0
  255. package/lib/plugins/security/index.js +41 -0
  256. package/lib/plugins/security/index.js.map +1 -0
  257. package/lib/plugins/service-channels/capacity/index.d.ts +18 -0
  258. package/lib/plugins/service-channels/capacity/index.js +194 -0
  259. package/lib/plugins/service-channels/capacity/index.js.map +1 -0
  260. package/lib/plugins/service-channels/index.d.ts +12 -0
  261. package/lib/plugins/service-channels/index.e2e-spec.d.ts +1 -0
  262. package/lib/plugins/service-channels/index.e2e-spec.js +67 -0
  263. package/lib/plugins/service-channels/index.e2e-spec.js.map +1 -0
  264. package/lib/plugins/service-channels/index.js +37 -0
  265. package/lib/plugins/service-channels/index.js.map +1 -0
  266. package/lib/plugins/slack/index.d.ts +9 -0
  267. package/lib/plugins/slack/index.e2e-spec.d.ts +1 -0
  268. package/lib/plugins/slack/index.e2e-spec.js +47 -0
  269. package/lib/plugins/slack/index.e2e-spec.js.map +1 -0
  270. package/lib/plugins/slack/index.js +111 -0
  271. package/lib/plugins/slack/index.js.map +1 -0
  272. package/lib/plugins/user-access-policies/index.d.ts +19 -0
  273. package/lib/plugins/user-access-policies/index.e2e-spec.d.ts +1 -0
  274. package/lib/plugins/user-access-policies/index.e2e-spec.js +61 -0
  275. package/lib/plugins/user-access-policies/index.e2e-spec.js.map +1 -0
  276. package/lib/plugins/user-access-policies/index.js +176 -0
  277. package/lib/plugins/user-access-policies/index.js.map +1 -0
  278. package/lib/plugins/user-access-policies/page.d.ts +30 -0
  279. package/lib/plugins/user-access-policies/page.js +114 -0
  280. package/lib/plugins/user-access-policies/page.js.map +1 -0
  281. package/lib/plugins/utils.d.ts +13 -0
  282. package/lib/plugins/utils.js +159 -0
  283. package/lib/plugins/utils.js.map +1 -0
  284. package/oclif.manifest.json +177 -0
  285. package/package.json +65 -0
@@ -0,0 +1,163 @@
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 pRetry from 'p-retry';
54
+ import { LoginPage } from './pages/login.js';
55
+ const VF_IFRAME_SELECTOR = 'force-aloha-page iframe[name^=vfFrameId]';
56
+ export class Browserforce {
57
+ connection;
58
+ browserContext;
59
+ logger;
60
+ retryConfig;
61
+ constructor(connection, browserContext, options) {
62
+ this.connection = connection;
63
+ this.browserContext = browserContext;
64
+ this.logger = options?.logger;
65
+ this.retryConfig = options?.retry ?? {
66
+ retries: 0,
67
+ };
68
+ }
69
+ async login() {
70
+ const env_1 = { stack: [], error: void 0, hasError: false };
71
+ try {
72
+ const page = __addDisposableResource(env_1, await this.browserContext.newPage(), true);
73
+ const loginPage = new LoginPage(page);
74
+ await loginPage.login(this.connection);
75
+ return this;
76
+ }
77
+ catch (e_1) {
78
+ env_1.error = e_1;
79
+ env_1.hasError = true;
80
+ }
81
+ finally {
82
+ const result_1 = __disposeResources(env_1);
83
+ if (result_1)
84
+ await result_1;
85
+ }
86
+ }
87
+ // path instead of url
88
+ async openPage(urlPath) {
89
+ let page;
90
+ const result = await this.retry(async () => {
91
+ page = await this.browserContext.newPage();
92
+ const setupUrl = urlPath.startsWith('/lightning') ? await this.getLightningSetupUrl() : this.getInstanceUrl();
93
+ const url = `${setupUrl}${urlPath}`;
94
+ const response = await page.goto(url);
95
+ if (response && !response.ok()) {
96
+ await Promise.race([
97
+ (async () => {
98
+ await page.waitForTimeout(5_000);
99
+ throw new Error(`${response.status()}: ${response.url()}`);
100
+ })(),
101
+ waitForPageErrors(page, 6_000),
102
+ ]);
103
+ }
104
+ return page;
105
+ });
106
+ return result;
107
+ }
108
+ // If LEX is enabled, the classic url will be opened in an iframe.
109
+ // Wait for either the selector in the page or in the iframe.
110
+ // returns the page or the frame locator
111
+ async waitForSelectorInFrameOrPage(page, selector) {
112
+ await page.locator(`${selector}, ${VF_IFRAME_SELECTOR}`).first().waitFor();
113
+ const iframeCount = await page.locator(VF_IFRAME_SELECTOR).count();
114
+ if (iframeCount > 0) {
115
+ const frameLocator = page.frameLocator(VF_IFRAME_SELECTOR);
116
+ await frameLocator.locator(selector).first().waitFor();
117
+ return frameLocator;
118
+ }
119
+ await page.locator(selector).first().waitFor();
120
+ return page;
121
+ }
122
+ getMyDomain() {
123
+ const instanceUrl = this.getInstanceUrl();
124
+ // acme.my.salesforce.com
125
+ // acme--<sandboxName>.csN.my.salesforce.com
126
+ const matches = instanceUrl.match(/https:\/\/(.*)\.my\.salesforce\.com/);
127
+ if (matches) {
128
+ return matches[1];
129
+ }
130
+ return null;
131
+ }
132
+ getInstanceUrl() {
133
+ // sometimes the instanceUrl includes a trailing slash
134
+ return this.connection.instanceUrl?.replace(/\/$/, '');
135
+ }
136
+ /**
137
+ * @returns the setup url (e.g. https://[MyDomainName].my.salesforce-setup.com)
138
+ */
139
+ async getLightningSetupUrl() {
140
+ return `https://${this.getMyDomain()}.my.salesforce-setup.com`;
141
+ }
142
+ async retry(input) {
143
+ const res = await pRetry(input, {
144
+ ...this.retryConfig,
145
+ onFailedAttempt: (context) => {
146
+ this.logger?.warn(`retrying ${context.retriesLeft} more time(s) because of "${context.error}"`);
147
+ },
148
+ });
149
+ return res;
150
+ }
151
+ }
152
+ export async function waitForPageErrors(page, timeout = 90_000) {
153
+ const anyErrorsLocator = page.locator(`#error, #errorTitle, #errorDesc, #validationError, div.errorMsg`);
154
+ await anyErrorsLocator.first().waitFor({ state: 'attached', timeout });
155
+ const errorMessages = (await anyErrorsLocator.allInnerTexts()).map((t) => t.trim()).filter(Boolean);
156
+ if (errorMessages.length === 1) {
157
+ throw new Error(errorMessages[0]);
158
+ }
159
+ else if (errorMessages.length > 1) {
160
+ throw new Error(errorMessages.join('\n'));
161
+ }
162
+ }
163
+ //# sourceMappingURL=browserforce.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browserforce.js","sourceRoot":"","sources":["../src/browserforce.ts"],"names":[],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gB,CAAC,aAAa,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACpG,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,CAAC;SAAM,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC"}
@@ -0,0 +1,10 @@
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 {};
@@ -0,0 +1,83 @@
1
+ import { readFileSync } from 'fs';
2
+ import { BrowserforceCommand } from '../../browserforce-command.js';
3
+ import { maskSensitiveValues } from '../../plugins/utils.js';
4
+ // Convert camelCase to kebab-case (e.g., "authProviders" -> "auth-providers")
5
+ function camelToKebab(str) {
6
+ return str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
7
+ }
8
+ // Load schema for a plugin
9
+ function loadPluginSchema(pluginName) {
10
+ try {
11
+ // Resolve schema path relative to the plugins directory
12
+ // Since we're in src/commands/browserforce/, we need to go up to src/plugins/
13
+ const schemaPath = new URL(`../../plugins/${camelToKebab(pluginName)}/schema.json`, import.meta.url);
14
+ const schemaContent = readFileSync(schemaPath, 'utf8');
15
+ return JSON.parse(schemaContent);
16
+ }
17
+ catch (error) {
18
+ // Schema file not found or invalid - return undefined to fall back to pattern matching
19
+ return undefined;
20
+ }
21
+ }
22
+ export class BrowserforceApply extends BrowserforceCommand {
23
+ static description = 'apply a plan from a config file';
24
+ static examples = [
25
+ `$ <%= config.bin %> <%= command.id %> -f ./config/currency.json --target-org myOrg@example.com
26
+ logging in... done
27
+ Applying config file ./config/currency.json to org myOrg@example.com
28
+ [CompanyInformation] retrieving state... done
29
+ [CompanyInformation] changing 'defaultCurrencyIsoCode' to '"English (South Africa) - ZAR"'... done
30
+ logging out... done
31
+ `,
32
+ ];
33
+ async run() {
34
+ const { flags } = await this.parse(BrowserforceApply);
35
+ this.log(`Applying config file ${flags.definitionfile} to org ${flags['target-org'].getUsername()}`);
36
+ for (const setting of this.settings) {
37
+ const driver = setting.Driver;
38
+ const instance = new driver(this.browserforce);
39
+ this.spinner.start(`[${driver.name}] retrieving state`);
40
+ await this.browserforce.browserContext.tracing.group(driver.name);
41
+ let state;
42
+ try {
43
+ state = await instance.retrieve(setting.value);
44
+ }
45
+ catch (err) {
46
+ this.spinner.stop('failed');
47
+ throw err;
48
+ }
49
+ this.spinner.stop();
50
+ const diff = instance.diff(state, setting.value);
51
+ const action = flags['dry-run'] ? 'would change' : 'changing';
52
+ if (diff !== undefined) {
53
+ // Load schema for this plugin to check for password fields
54
+ const schema = loadPluginSchema(setting.key);
55
+ // Mask sensitive values before logging (using schema if available)
56
+ const maskedDiff = maskSensitiveValues(diff, '', schema);
57
+ this.spinner.start(`[${driver.name}] ${Object.keys(maskedDiff)
58
+ .map((key) => {
59
+ return `${action} '${key}' to '${JSON.stringify(maskedDiff[key])}'`;
60
+ })
61
+ .join('\n')}`);
62
+ if (!flags['dry-run']) {
63
+ try {
64
+ await instance.apply(diff);
65
+ }
66
+ catch (err) {
67
+ this.spinner.stop('failed');
68
+ throw err;
69
+ }
70
+ this.spinner.stop();
71
+ }
72
+ await this.browserforce.browserContext.tracing.groupEnd();
73
+ }
74
+ else {
75
+ this.log(`[${driver.name}] no action necessary`);
76
+ }
77
+ }
78
+ return {
79
+ success: true,
80
+ };
81
+ }
82
+ }
83
+ //#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,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;oBACX,OAAO,GAAG,MAAM,KAAK,GAAG,SAAS,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC;gBACtE,CAAC,CAAC;qBACD,IAAI,CAAC,IAAI,CAAC,EAAE,CAChB,CAAC;gBACF,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;oBACtB,IAAI,CAAC;wBACH,MAAM,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;oBAC7B,CAAC;oBAAC,OAAO,GAAG,EAAE,CAAC;wBACb,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;wBAC5B,MAAM,GAAG,CAAC;oBACZ,CAAC;oBACD,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;gBACtB,CAAC;gBACD,MAAM,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;YAC5D,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"}
@@ -0,0 +1,9 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ export declare class BrowserforcePlaywrightCommand extends SfCommand<string> {
3
+ static description: string;
4
+ static examples: string[];
5
+ static strict: boolean;
6
+ static enableJsonFlag: boolean;
7
+ static baseFlags: any;
8
+ run(): Promise<string>;
9
+ }
@@ -0,0 +1,53 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ import { spawn } from 'child_process';
3
+ import { dirname } from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+ const __dirname = dirname(fileURLToPath(import.meta.url));
6
+ export class BrowserforcePlaywrightCommand extends SfCommand {
7
+ static description = 'access the Playwright CLI';
8
+ static examples = [
9
+ `$ <%= config.bin %> <%= command.id %> -- --help`,
10
+ `$ <%= config.bin %> <%= command.id %> -- --version`,
11
+ `$ <%= config.bin %> <%= command.id %> -- install --list`,
12
+ `$ <%= config.bin %> <%= command.id %> -- install chromium`,
13
+ ];
14
+ static strict = false;
15
+ static enableJsonFlag = false;
16
+ static baseFlags = undefined;
17
+ async run() {
18
+ const { argv } = await this.parse(BrowserforcePlaywrightCommand);
19
+ const args = argv;
20
+ const isTest = process.env.NODE_ENV === 'test' || process.env.npm_lifecycle_event === 'test';
21
+ const child = spawn('npx', ['playwright', ...args], {
22
+ // Run this command wherever browserforce has been installed to.
23
+ // When running npx playwright install in another folder, it needs to be downloaded first
24
+ // AND it could resolve to another playwright version not compatible with sfdx-browserforce-plugin.
25
+ cwd: __dirname,
26
+ stdio: 'pipe',
27
+ });
28
+ return new Promise((resolve, reject) => {
29
+ let stdout = '';
30
+ if (!isTest) {
31
+ child.stdout?.pipe(process.stdout);
32
+ child.stderr?.pipe(process.stderr);
33
+ }
34
+ else {
35
+ child.stdout.on('data', (chunk) => {
36
+ stdout += chunk.toString();
37
+ });
38
+ }
39
+ child.on('close', (code) => {
40
+ if (code === 0) {
41
+ resolve(stdout);
42
+ }
43
+ else {
44
+ process.exit(code || 1);
45
+ }
46
+ });
47
+ child.on('error', (error) => {
48
+ reject(error);
49
+ });
50
+ });
51
+ }
52
+ }
53
+ //# sourceMappingURL=playwright.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"playwright.js","sourceRoot":"","sources":["../../../src/commands/browserforce/playwright.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,SAAS,GAAG,OAAO,CAAC,aA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AAE;oBAChC,MAAM,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;gBAC7B,CAAC,CAAC,CAAC;YACL,CAAC;YAED,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;gBACzB,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;oBACf,OAAO,CAAC,MAAM,CAAC,CAAC;gBAClB,CAAC;qBAAM,CAAC;oBACN,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC;gBAC1B,CAAC;YACH,CAAC,CAAC,CAAC;YAEH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;gBAC1B,MAAM,CAAC,KAAK,CAAC,CAAC;YAChB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC"}
@@ -0,0 +1,16 @@
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 {};
@@ -0,0 +1,24 @@
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
@@ -0,0 +1 @@
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,CAAC,gCAAgC,UAAU,oBAAoB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBACxG,CAAC;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,+CAA+C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACzF,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
package/lib/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
package/lib/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
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 declare function ensureArray<T>(prop: T | T[]): T[];
@@ -0,0 +1,14 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,7 @@
1
+ import { type Connection } from '@salesforce/core';
2
+ import { type Page } from 'playwright';
3
+ export declare class LoginPage {
4
+ private page;
5
+ constructor(page: Page);
6
+ login(connection: Connection): Promise<this>;
7
+ }
@@ -0,0 +1,17 @@
1
+ import { Org } from '@salesforce/core';
2
+ import { waitForPageErrors } from '../browserforce.js';
3
+ const POST_LOGIN_PATH = '/setup/forcecomHomepage.apexp';
4
+ export class LoginPage {
5
+ page;
6
+ constructor(page) {
7
+ this.page = page;
8
+ }
9
+ async login(connection) {
10
+ const org = await Org.create({ connection });
11
+ const frontDoorUrl = await org.getFrontDoorUrl(POST_LOGIN_PATH);
12
+ await this.page.goto(frontDoorUrl);
13
+ await Promise.race([this.page.waitForURL((url) => url.pathname === POST_LOGIN_PATH), waitForPageErrors(this.page)]);
14
+ return this;
15
+ }
16
+ }
17
+ //# sourceMappingURL=login.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/pages/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAmB,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,eAAe,GAAG,+BAA+B,CAAC;AAExD,MAAM,OAAO,SAAS;IACZ,IAAI,CAAO;IAEnB,YAAY,IAAU;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,UAAsB;QAChC,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC;QAC7C,MAAM,YAAY,GAAG,MAAM,GAAG,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC;QAChE,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACnC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,KAAK,eAAe,CAAC,EAAE,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpH,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
@@ -0,0 +1,15 @@
1
+ import { Browserforce } from './browserforce.js';
2
+ export declare abstract class BrowserforcePlugin {
3
+ protected browserforce: Browserforce;
4
+ constructor(browserforce: Browserforce);
5
+ abstract retrieve(definition?: unknown): Promise<unknown>;
6
+ /**
7
+ * deep diff
8
+ * @param state
9
+ * @param definition
10
+ * @returns undefined when there is no diff
11
+ */
12
+ diff(state: unknown, definition: unknown): unknown;
13
+ abstract apply(plan: unknown): Promise<unknown>;
14
+ run(definition: unknown): Promise<unknown>;
15
+ }
package/lib/plugin.js ADDED
@@ -0,0 +1,28 @@
1
+ import { deepDiff } from './plugins/utils.js';
2
+ export class BrowserforcePlugin {
3
+ browserforce;
4
+ constructor(browserforce) {
5
+ this.browserforce = browserforce;
6
+ }
7
+ /**
8
+ * deep diff
9
+ * @param state
10
+ * @param definition
11
+ * @returns undefined when there is no diff
12
+ */
13
+ diff(state, definition) {
14
+ return deepDiff(state, definition);
15
+ }
16
+ async run(definition) {
17
+ const state = await this.retrieve(definition);
18
+ const diff = this.diff(state, definition);
19
+ if (diff !== undefined) {
20
+ const result = await this.apply(diff);
21
+ return result;
22
+ }
23
+ return {
24
+ message: 'no action necessary',
25
+ };
26
+ }
27
+ }
28
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,MAAM,OAAgB,kBAAkB;IAC5B,YAAY,CAAe;IAErC,YAAmB,YAA0B;QAC3C,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACI,IAAI,CAAC,KAAc,EAAE,UAAmB;QAC7C,OAAO,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IACrC,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,UAAmB;QAClC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QAC1C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACtC,OAAO,MAAM,CAAC;QAChB,CAAC;QACD,OAAO;YACL,OAAO,EAAE,qBAAqB;SAC/B,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,9 @@
1
+ import { BrowserforcePlugin } from '../../plugin.js';
2
+ type Config = {
3
+ allowUsersToRelateMultipleContactsToTasksAndEvents: boolean;
4
+ };
5
+ export declare class ActivitySettings extends BrowserforcePlugin {
6
+ retrieve(): Promise<Config>;
7
+ apply(config: Config): Promise<void>;
8
+ }
9
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,36 @@
1
+ import assert from 'assert';
2
+ import { ActivitySettings } from './index.js';
3
+ describe(ActivitySettings.name, function () {
4
+ let plugin;
5
+ before(() => {
6
+ plugin = new ActivitySettings(global.browserforce);
7
+ });
8
+ describe('allowUsersToRelateMultipleContactsToTasksAndEvents', () => {
9
+ const configEnabled = {
10
+ allowUsersToRelateMultipleContactsToTasksAndEvents: true,
11
+ };
12
+ const configDisabled = {
13
+ allowUsersToRelateMultipleContactsToTasksAndEvents: false,
14
+ };
15
+ it('should enable', async () => {
16
+ await plugin.run(configEnabled);
17
+ });
18
+ it('should be enabled', async () => {
19
+ const res = await plugin.retrieve();
20
+ assert.deepStrictEqual(res, configEnabled);
21
+ });
22
+ it('should fail to disable', async () => {
23
+ let err;
24
+ try {
25
+ await plugin.apply(configDisabled);
26
+ }
27
+ catch (e) {
28
+ err = e;
29
+ }
30
+ assert.throws(() => {
31
+ throw err;
32
+ }, /can only be disabled/);
33
+ });
34
+ });
35
+ });
36
+ //# sourceMappingURL=index.e2e-spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.e2e-spec.js","sourceRoot":"","sources":["../../../src/plugins/activity-settings/index.e2e-spec.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,QAAQ,CAAC,gBAAgB,CAAC,IAAI,EAAE;IAC9B,IAAI,MAAwB,CAAC;IAC7B,MAAM,CAAC,GAAG,EAAE;QACV,MAAM,GAAG,IAAI,gBAAgB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,oDAAoD,EAAE,G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